Class: Smartgen::Engine::Base
- Inherits:
-
Object
- Object
- Smartgen::Engine::Base
- Defined in:
- lib/smartgen/engines/base.rb
Overview
Base class for engines.
An engine process markup files, converting them to HTML.
Class Method Summary collapse
-
.register(processor) ⇒ Object
Registers a pre processor for this engine.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#process(body, metadata = Smartgen::ObjectHash.new) ⇒ Object
Process a file, calling each pre processor if any.
-
#supported?(extension) ⇒ Boolean
Returns true if the given extension is supported by this engine.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/smartgen/engines/base.rb', line 12 def initialize self.pre_processors ||= [] end |
Class Method Details
.register(processor) ⇒ Object
Registers a pre processor for this engine.
28 29 30 31 |
# File 'lib/smartgen/engines/base.rb', line 28 def register(processor) self.pre_processors ||= [] self.pre_processors << processor end |
Instance Method Details
#process(body, metadata = Smartgen::ObjectHash.new) ⇒ Object
Process a file, calling each pre processor if any.
17 18 19 |
# File 'lib/smartgen/engines/base.rb', line 17 def process(body, =Smartgen::ObjectHash.new) parse(pre_process(body, ), ) end |
#supported?(extension) ⇒ Boolean
Returns true if the given extension is supported by this engine.
22 23 24 |
# File 'lib/smartgen/engines/base.rb', line 22 def supported?(extension) extensions.include?(extension) end |