Class: Groonga::Schema::ColumnRemoveDefinition
- Inherits:
-
Object
- Object
- Groonga::Schema::ColumnRemoveDefinition
- Includes:
- Path
- Defined in:
- lib/groonga/schema.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #define(table_definition, table) ⇒ Object
-
#initialize(name, options = {}) ⇒ ColumnRemoveDefinition
constructor
A new instance of ColumnRemoveDefinition.
Methods included from Path
#columns_directory_path, #rmdir_if_available, #tables_directory_path
Constructor Details
#initialize(name, options = {}) ⇒ ColumnRemoveDefinition
Returns a new instance of ColumnRemoveDefinition.
1563 1564 1565 1566 1567 |
# File 'lib/groonga/schema.rb', line 1563 def initialize(name, ={}) @name = name @name = @name.to_s if @name.is_a?(Symbol) @options = ( || {}).dup end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
1560 1561 1562 |
# File 'lib/groonga/schema.rb', line 1560 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
1561 1562 1563 |
# File 'lib/groonga/schema.rb', line 1561 def @options end |
Instance Method Details
#define(table_definition, table) ⇒ Object
1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 |
# File 'lib/groonga/schema.rb', line 1569 def define(table_definition, table) if @name.respond_to?(:call) name = @name.call(table_definition.context) else name = @name end column = table.column(name) if column.nil? raise ColumnNotExists.new(name) end result = column.remove columns_dir = columns_directory_path(table) rmdir_if_available(columns_dir) result end |