Class: ModelGenerator
Instance Method Summary collapse
- #execute(model) ⇒ Object
-
#initialize(gen_dir = 'gen/') ⇒ ModelGenerator
constructor
A new instance of ModelGenerator.
- #undo(model) ⇒ Object
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.(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 |