Class: DMGen::OneFile
- Inherits:
-
Templater::Generator
- Object
- Templater::Generator
- DMGen::OneFile
- Defined in:
- lib/dm-gen/generators/one_file.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
19 20 21 |
# File 'lib/dm-gen/generators/one_file.rb', line 19 def self.source_root File.join(File.dirname(__FILE__), '..', 'templates') end |
Instance Method Details
#filename ⇒ Object
32 33 34 |
# File 'lib/dm-gen/generators/one_file.rb', line 32 def filename name.sub(/\.rb\z/,'') end |
#model_name ⇒ Object
28 29 30 |
# File 'lib/dm-gen/generators/one_file.rb', line 28 def model_name (model) ? model.camel_case : "TestModel" end |
#properties ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dm-gen/generators/one_file.rb', line 36 def properties h = {} attributes.each do |k, v| # skip if the property is named id next if k == "id" # convert to snake/camel case h[k.snake_case] = v.camel_case end h end |