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.
408 409 410 |
# File 'lib/migration_defs.rb', line 408 def initialize(name) @name = name end |
Instance Attribute Details
#column_name ⇒ Object
Returns the value of attribute column_name.
406 407 408 |
# File 'lib/migration_defs.rb', line 406 def column_name @column_name end |
#name ⇒ Object
Returns the value of attribute name.
406 407 408 |
# File 'lib/migration_defs.rb', line 406 def name @name end |
#new_column_name ⇒ Object
Returns the value of attribute new_column_name.
406 407 408 |
# File 'lib/migration_defs.rb', line 406 def new_column_name @new_column_name end |
Instance Method Details
#add_column_name(column_name) ⇒ Object
412 413 414 |
# File 'lib/migration_defs.rb', line 412 def add_column_name(column_name) @column_name = column_name end |
#add_new_column_name(column_name) ⇒ Object
416 417 418 |
# File 'lib/migration_defs.rb', line 416 def add_new_column_name(column_name) @new_column_name = column_name end |
#get_str ⇒ Object
425 426 427 |
# File 'lib/migration_defs.rb', line 425 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
420 421 422 423 |
# File 'lib/migration_defs.rb', line 420 def parse_from_params(parse_params) @column_name = parse_params[:column_name] @new_column_name = parse_params[:new_column_name] end |