Class: Ibrain::Core::ModelGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ibrain::Core::ModelGenerator
- Defined in:
- lib/generators/ibrain/core/model_generator.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Instance Method Summary collapse
- #create_model_file ⇒ Object
-
#initialize(args, *options) ⇒ ModelGenerator
constructor
:nodoc:.
Constructor Details
#initialize(args, *options) ⇒ ModelGenerator
:nodoc:
17 18 19 20 21 22 23 |
# File 'lib/generators/ibrain/core/model_generator.rb', line 17 def initialize(args, *) # :nodoc: # Unfreeze name in case it's given as a frozen string args[0] = args[0].dup if args[0].is_a?(String) && args[0].frozen? super assign_names!(name) end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
25 26 27 |
# File 'lib/generators/ibrain/core/model_generator.rb', line 25 def file_name @file_name end |
Instance Method Details
#create_model_file ⇒ Object
27 28 29 |
# File 'lib/generators/ibrain/core/model_generator.rb', line 27 def create_model_file template "model.erb", "app/models/#{file_name}.rb" end |