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.
1760 1761 1762 1763 1764 |
# File 'lib/groonga/schema.rb', line 1760 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.
1757 1758 1759 |
# File 'lib/groonga/schema.rb', line 1757 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
1758 1759 1760 |
# File 'lib/groonga/schema.rb', line 1758 def @options end |
Instance Method Details
#define(table_definition, table) ⇒ Object
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 |
# File 'lib/groonga/schema.rb', line 1766 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 |