Class: Groonga::Schema::ColumnDefinition
- Inherits:
-
Object
- Object
- Groonga::Schema::ColumnDefinition
- 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.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #define(table_definition, table) ⇒ Object
-
#initialize(name, options = {}) ⇒ ColumnDefinition
constructor
A new instance of ColumnDefinition.
Methods included from Path
#columns_directory_path, #rmdir_if_available, #tables_directory_path
Constructor Details
#initialize(name, options = {}) ⇒ ColumnDefinition
Returns a new instance of ColumnDefinition.
1752 1753 1754 1755 1756 1757 |
# File 'lib/groonga/schema.rb', line 1752 def initialize(name, ={}) @name = name @name = @name.to_s if @name.is_a?(Symbol) @options = ( || {}).dup @type = nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
1749 1750 1751 |
# File 'lib/groonga/schema.rb', line 1749 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
1750 1751 1752 |
# File 'lib/groonga/schema.rb', line 1750 def @options end |
#type ⇒ Object
Returns the value of attribute type.
1749 1750 1751 |
# File 'lib/groonga/schema.rb', line 1749 def type @type end |
Instance Method Details
#define(table_definition, table) ⇒ Object
1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 |
# File 'lib/groonga/schema.rb', line 1759 def define(table_definition, table) context = table_definition.context column = table.column(@name) = (context, table) if column return column if same_column?(context, column) if @options[:force] column.remove else raise ColumnCreationWithDifferentOptions.new(column, ) end end table.define_column(@name, resolved_type(context), ) end |