Class: Groonga::Schema::ColumnRenameDefinition
- Inherits:
-
Object
- Object
- Groonga::Schema::ColumnRenameDefinition
- Includes:
- Path
- Defined in:
- lib/groonga/schema.rb
Instance Attribute Summary collapse
-
#current_name ⇒ Object
Returns the value of attribute current_name.
-
#new_name ⇒ Object
Returns the value of attribute new_name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #define(table_definition, table) ⇒ Object
-
#initialize(current_name, new_name, options = {}) ⇒ ColumnRenameDefinition
constructor
A new instance of ColumnRenameDefinition.
Methods included from Path
#columns_directory_path, #rmdir_if_available, #tables_directory_path
Constructor Details
#initialize(current_name, new_name, options = {}) ⇒ ColumnRenameDefinition
Returns a new instance of ColumnRenameDefinition.
1626 1627 1628 1629 1630 1631 1632 |
# File 'lib/groonga/schema.rb', line 1626 def initialize(current_name, new_name, ={}) @current_name = current_name @current_name = @current_name.to_s if @current_name.is_a?(Symbol) @new_name = new_name @new_name = @new_name.to_s if @new_name.is_a?(Symbol) = ( || {}).dup end |
Instance Attribute Details
#current_name ⇒ Object
Returns the value of attribute current_name.
1623 1624 1625 |
# File 'lib/groonga/schema.rb', line 1623 def current_name @current_name end |
#new_name ⇒ Object
Returns the value of attribute new_name.
1623 1624 1625 |
# File 'lib/groonga/schema.rb', line 1623 def new_name @new_name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
1624 1625 1626 |
# File 'lib/groonga/schema.rb', line 1624 def end |
Instance Method Details
#define(table_definition, table) ⇒ Object
1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 |
# File 'lib/groonga/schema.rb', line 1634 def define(table_definition, table) if @current_name.respond_to?(:call) current_name = @current_name.call(table_definition.context) else current_name = @current_name end column = table.column(current_name) if column.nil? raise ColumnNotExists.new(name) end column.rename(@new_name) end |