Class: Nova::Engine
- Inherits:
-
Object
- Object
- Nova::Engine
- Defined in:
- lib/cocoanova/engine.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ERB
Constant Summary collapse
- Registry =
{}
Class Method Summary collapse
-
.[](ext) ⇒ Object
Get subclass.
-
.extension(*exts) ⇒ Object
Register a subclass for file extension.
-
.require_all ⇒ Object
Load all engines.
-
.supported_extensions ⇒ Object
Supported extensions, all symbol.
Instance Method Summary collapse
-
#render(template, data, filename) ⇒ Object
Execute render.
Class Method Details
.[](ext) ⇒ Object
Get subclass
16 17 18 |
# File 'lib/cocoanova/engine.rb', line 16 def self.[](ext) Registry[ext.to_sym] end |
.extension(*exts) ⇒ Object
Register a subclass for file extension
23 24 25 26 27 28 |
# File 'lib/cocoanova/engine.rb', line 23 def self.extension(*exts) exts.flatten.each do |ext| Registry[ext.to_sym] = self puts "Engine Loaded: '#{self}' registered to extension '#{ext}'" end end |
.require_all ⇒ Object
Load all engines
6 7 8 |
# File 'lib/cocoanova/engine.rb', line 6 def self.require_all Nova.require_folder :engines end |
.supported_extensions ⇒ Object
Supported extensions, all symbol
11 12 13 |
# File 'lib/cocoanova/engine.rb', line 11 def self.supported_extensions Registry.keys end |
Instance Method Details
#render(template, data, filename) ⇒ Object
Execute render
31 32 33 |
# File 'lib/cocoanova/engine.rb', line 31 def render(template, data, filename) raise "#{self}#render not implemented." end |