Class: Nova::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoanova/engine.rb

Direct Known Subclasses

ERB

Defined Under Namespace

Classes: ERB

Constant Summary collapse

Registry =
{}

Class Method Summary collapse

Instance Method Summary collapse

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_allObject

Load all engines



6
7
8
# File 'lib/cocoanova/engine.rb', line 6

def self.require_all
    Nova.require_folder :engines
end

.supported_extensionsObject

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