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.
1473 1474 1475 1476 1477 1478 |
# File 'lib/groonga/schema.rb', line 1473 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.
1470 1471 1472 |
# File 'lib/groonga/schema.rb', line 1470 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
1471 1472 1473 |
# File 'lib/groonga/schema.rb', line 1471 def @options end |
#type ⇒ Object
Returns the value of attribute type.
1470 1471 1472 |
# File 'lib/groonga/schema.rb', line 1470 def type @type end |
Instance Method Details
#define(table_definition, table) ⇒ Object
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 |
# File 'lib/groonga/schema.rb', line 1480 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 |