Class: RBCliTool::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/rbcli-tool/generators.rb

Direct Known Subclasses

Command, Extern, Hook

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil, root_path = nil, template_vars = {}) ⇒ Generator

Returns a new instance of Generator.



28
29
30
# File 'lib/rbcli-tool/generators.rb', line 28

def initialize type = nil, root_path = nil, template_vars = {}
  @generator = @@types[type.to_s.downcase].new root_path, template_vars
end

Class Method Details

.inherited(subklass) ⇒ Object



23
24
25
26
# File 'lib/rbcli-tool/generators.rb', line 23

def self.inherited(subklass)
  @@types ||= {}
  @@types[subklass.name.downcase.split('::')[1]] = subklass
end

Instance Method Details

#run(*args) ⇒ Object



32
33
34
# File 'lib/rbcli-tool/generators.rb', line 32

def run *args
  @generator.run *args
end