Class: FastChangeTable::InstanceMethods::PhoneyIndex
- Inherits:
-
Object
- Object
- FastChangeTable::InstanceMethods::PhoneyIndex
- Defined in:
- lib/fast_change_table/fast_change_table.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#lengths ⇒ Object
Returns the value of attribute lengths.
-
#name ⇒ Object
Returns the value of attribute name.
-
#unique ⇒ Object
Returns the value of attribute unique.
Instance Method Summary collapse
- #==(val) ⇒ Object
-
#initialize(table, cols, options) ⇒ PhoneyIndex
constructor
A new instance of PhoneyIndex.
Constructor Details
#initialize(table, cols, options) ⇒ PhoneyIndex
Returns a new instance of PhoneyIndex.
132 133 134 135 136 137 138 139 |
# File 'lib/fast_change_table/fast_change_table.rb', line 132 def initialize(table, cols, ) cols = [cols].flatten self.columns = cols.collect(&:to_s) self.lengths = [:length] self.unique = !![:unique] self.name = [:name] || "index_#{table}_on_#{columns.join('_and_')}" self.name = "#{columns.join('_')}_idx" if name.length > 64 end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
130 131 132 |
# File 'lib/fast_change_table/fast_change_table.rb', line 130 def columns @columns end |
#lengths ⇒ Object
Returns the value of attribute lengths.
130 131 132 |
# File 'lib/fast_change_table/fast_change_table.rb', line 130 def lengths @lengths end |
#name ⇒ Object
Returns the value of attribute name.
130 131 132 |
# File 'lib/fast_change_table/fast_change_table.rb', line 130 def name @name end |
#unique ⇒ Object
Returns the value of attribute unique.
130 131 132 |
# File 'lib/fast_change_table/fast_change_table.rb', line 130 def unique @unique end |
Instance Method Details
#==(val) ⇒ Object
141 142 143 |
# File 'lib/fast_change_table/fast_change_table.rb', line 141 def ==(val) columns == val.columns rescue false end |