Class: ActiveRecord::ConnectionAdapters::Spanner::IndexDefinition
- Inherits:
-
IndexDefinition
- Object
- IndexDefinition
- ActiveRecord::ConnectionAdapters::Spanner::IndexDefinition
- Defined in:
- lib/active_record/connection_adapters/spanner/schema_definitions.rb
Instance Attribute Summary collapse
-
#interleave_in ⇒ Object
readonly
Returns the value of attribute interleave_in.
-
#null_filtered ⇒ Object
readonly
Returns the value of attribute null_filtered.
-
#orders ⇒ Object
readonly
Returns the value of attribute orders.
-
#storing ⇒ Object
readonly
Returns the value of attribute storing.
Instance Method Summary collapse
- #columns_with_order ⇒ Object
-
#initialize(table_name, name, columns, unique: false, null_filtered: false, interleave_in: nil, storing: nil, orders: nil) ⇒ IndexDefinition
constructor
A new instance of IndexDefinition.
Constructor Details
#initialize(table_name, name, columns, unique: false, null_filtered: false, interleave_in: nil, storing: nil, orders: nil) ⇒ IndexDefinition
Returns a new instance of IndexDefinition.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 101 def initialize \ table_name, name, columns, unique: false, null_filtered: false, interleave_in: nil, storing: nil, orders: nil @table = table_name @name = name @unique = unique @null_filtered = null_filtered @interleave_in = interleave_in @storing = Array(storing) columns = columns.split(/\W/) if columns.is_a? String @columns = Array(columns).map(&:to_s) @orders = orders || {} unless @orders.is_a? Hash @orders = columns.each_with_object({}) { |c, r| r[c] = orders } end @orders = @orders.symbolize_keys end |
Instance Attribute Details
#interleave_in ⇒ Object (readonly)
Returns the value of attribute interleave_in.
99 100 101 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 99 def interleave_in @interleave_in end |
#null_filtered ⇒ Object (readonly)
Returns the value of attribute null_filtered.
99 100 101 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 99 def null_filtered @null_filtered end |
#orders ⇒ Object (readonly)
Returns the value of attribute orders.
99 100 101 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 99 def orders @orders end |
#storing ⇒ Object (readonly)
Returns the value of attribute storing.
99 100 101 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 99 def storing @storing end |
Instance Method Details
#columns_with_order ⇒ Object
127 128 129 130 131 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 127 def columns_with_order columns.each_with_object({}) do |c, result| result[c] = orders[c.to_sym].to_s.upcase end end |