Module: RoCommands::Generators::RailsGenerator::ClassMethods
- Includes:
- BaseGenerator::ClassMethods
- Defined in:
- lib/ro_commands/generators/rails_generator.rb
Instance Attribute Summary collapse
-
#tofile ⇒ Object
Returns the value of attribute tofile.
Attributes included from BaseGenerator::ClassMethods
Instance Method Summary collapse
Methods included from BaseGenerator::ClassMethods
#create, #created_file, #ctn, #file_name, #file_write, #lastest_file, #lib_path, #open, #path, #reset, #to
Instance Attribute Details
#tofile ⇒ Object
Returns the value of attribute tofile.
29 30 31 |
# File 'lib/ro_commands/generators/rails_generator.rb', line 29 def tofile @tofile end |
Instance Method Details
#template ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/ro_commands/generators/rails_generator.rb', line 15 def template template_path = File. "../rails_templates/#{template_name}.erb" if File.exist?(template_path) ctn = RoFile.read(File.("../rails_templates/#{template_name}.erb", __FILE__)) result = ::ERB.new(ctn).result(name.send(:binding)) RoFile.write(tofile, result) end end |
#template_name ⇒ Object
25 26 27 |
# File 'lib/ro_commands/generators/rails_generator.rb', line 25 def template_name name.split("::").last.uncamelize end |