Class: MigrationDefs::RenameColumnFunc
- Inherits:
-
AbstractMigrationClass
- Object
- AbstractMigrationClass
- MigrationDefs::RenameColumnFunc
- Defined in:
- lib/migration_defs.rb
Instance Attribute Summary collapse
-
#column_name ⇒ Object
Returns the value of attribute column_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#new_column_name ⇒ Object
Returns the value of attribute new_column_name.
Instance Method Summary collapse
- #add_column_name(column_name) ⇒ Object
- #add_new_column_name(column_name) ⇒ Object
- #get_str ⇒ Object
-
#initialize(name) ⇒ RenameColumnFunc
constructor
A new instance of RenameColumnFunc.
- #parse_from_params(parse_params) ⇒ Object
Constructor Details
#initialize(name) ⇒ RenameColumnFunc
Returns a new instance of RenameColumnFunc.
409 410 411 |
# File 'lib/migration_defs.rb', line 409 def initialize(name) @name = name end |
Instance Attribute Details
#column_name ⇒ Object
Returns the value of attribute column_name.
407 408 409 |
# File 'lib/migration_defs.rb', line 407 def column_name @column_name end |
#name ⇒ Object
Returns the value of attribute name.
407 408 409 |
# File 'lib/migration_defs.rb', line 407 def name @name end |
#new_column_name ⇒ Object
Returns the value of attribute new_column_name.
407 408 409 |
# File 'lib/migration_defs.rb', line 407 def new_column_name @new_column_name end |
Instance Method Details
#add_column_name(column_name) ⇒ Object
413 414 415 |
# File 'lib/migration_defs.rb', line 413 def add_column_name(column_name) @column_name = column_name end |
#add_new_column_name(column_name) ⇒ Object
417 418 419 |
# File 'lib/migration_defs.rb', line 417 def add_new_column_name(column_name) @new_column_name = column_name end |
#get_str ⇒ Object
426 427 428 |
# File 'lib/migration_defs.rb', line 426 def get_str "rename_column :#{@name}" + (@column_name.blank? ? '' : ", :#{@column_name}") + (@new_column_name.blank? ? '' : ", :#{@new_column_name}") + "\n" end |
#parse_from_params(parse_params) ⇒ Object
421 422 423 424 |
# File 'lib/migration_defs.rb', line 421 def parse_from_params(parse_params) @column_name = parse_params[:column_name] @new_column_name = parse_params[:new_column_name] end |