Class: Hanami::Commands::Generate::Migration
- Defined in:
- lib/hanami/commands/generate/migration.rb
Constant Summary collapse
- TIMESTAMP_FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'%Y%m%d%H%M%S'.freeze
- FILENAME_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'%{timestamp}_%{name}.rb'.freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#underscored_name ⇒ Object
readonly
Returns the value of attribute underscored_name.
Attributes inherited from Abstract
Instance Method Summary collapse
-
#initialize(options, name) ⇒ Migration
constructor
A new instance of Migration.
- #map_templates ⇒ Object
Methods inherited from Abstract
Methods included from Generators::Generatable
#add_mapping, #argument_blank?, #destroy, #generator, #post_process_templates, #process_templates, #start, #target_path, #template_options, #template_source_path
Methods inherited from Command
Constructor Details
#initialize(options, name) ⇒ Migration
Returns a new instance of Migration.
25 26 27 28 29 30 31 32 33 |
# File 'lib/hanami/commands/generate/migration.rb', line 25 def initialize(, name) super() @name = name @underscored_name = Utils::String.new(@name).underscore Components.resolve('model.configuration') assert_migration_name! end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/hanami/commands/generate/migration.rb', line 9 def name @name end |
#underscored_name ⇒ Object (readonly)
Returns the value of attribute underscored_name.
9 10 11 |
# File 'lib/hanami/commands/generate/migration.rb', line 9 def underscored_name @underscored_name end |
Instance Method Details
#map_templates ⇒ Object
35 36 37 |
# File 'lib/hanami/commands/generate/migration.rb', line 35 def map_templates add_mapping('migration.rb.tt', destination_path) end |