Class: Generator::Generator
- Defined in:
- lib/generator/generator.rb
Class Method Summary collapse
- .all ⇒ Object
- .description ⇒ Object
-
.use(helper_module) ⇒ Object
not neccesarily needed, because all Helpers are included by default.
Instance Method Summary collapse
-
#initialize ⇒ Generator
constructor
A new instance of Generator.
- #perform ⇒ Object
Methods inherited from Renderer
Constructor Details
#initialize ⇒ Generator
Returns a new instance of Generator.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generator/generator.rb', line 9 def initialize super(Configs.templates + configs(:templates), configs(:layout)) # include all Helpers Helper.constants .map { |c| Helper.const_get c } .each { |mod| extend mod if mod.is_a? Module } # Set Global Context to Dom's root node @_context = Dom.root end |
Class Method Details
.all ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/generator/generator.rb', line 43 def self.all # Otherwise we don't get the global Generator-Module gen_module = Object.const_get(:Generator) gen_module.constants .map { |c| gen_module.const_get c } .select { |klass| klass.class == Class and klass.superclass == self } end |
.description ⇒ Object
34 35 36 |
# File 'lib/generator/generator.rb', line 34 def self.description configs(:description) end |
.use(helper_module) ⇒ Object
not neccesarily needed, because all Helpers are included by default
39 40 41 |
# File 'lib/generator/generator.rb', line 39 def self.use(helper_module) include helper_module end |
Instance Method Details
#perform ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/generator/generator.rb', line 21 def perform unless self.respond_to? configs(:start_method) raise Exception, "#{self.class} needs to implement specified start-method '#{configs(:start_method)}'" end self.send configs(:start_method) end |