Class: ModelGenerator

Inherits:
Command show all
Defined in:
lib/jenson/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(gen_dir = 'gen/') ⇒ ModelGenerator

Returns a new instance of ModelGenerator.



19
20
21
22
23
# File 'lib/jenson/generator.rb', line 19

def initialize(gen_dir = 'gen/')
  @gen_dir = gen_dir
  f = File.expand_path(File.join(File.dirname(__FILE__), '../templates/model.rb.erb'))
  @template = File.read(f)
end

Instance Method Details

#execute(model) ⇒ Object



25
26
27
28
29
# File 'lib/jenson/generator.rb', line 25

def execute(model)
  @model = model
  model_file = File.new(self.output_path, 'w+')
  model_file.write(ERB.new(@model_template).result)
end

#undo(model) ⇒ Object



31
32
33
# File 'lib/jenson/generator.rb', line 31

def undo(model)

end