Class: FastChangeTable::InstanceMethods::PhoneyTable
- Inherits:
-
Object
- Object
- FastChangeTable::InstanceMethods::PhoneyTable
- Defined in:
- lib/fast_change_table/fast_change_table.rb
Instance Attribute Summary collapse
-
#indexes ⇒ Object
Returns the value of attribute indexes.
Instance Method Summary collapse
- #index(columns, options = {}) ⇒ Object
-
#initialize(tablename) ⇒ PhoneyTable
constructor
A new instance of PhoneyTable.
Constructor Details
#initialize(tablename) ⇒ PhoneyTable
Returns a new instance of PhoneyTable.
115 116 117 118 |
# File 'lib/fast_change_table/fast_change_table.rb', line 115 def initialize(tablename) @table = tablename @indexes = [] end |
Instance Attribute Details
#indexes ⇒ Object
Returns the value of attribute indexes.
113 114 115 |
# File 'lib/fast_change_table/fast_change_table.rb', line 113 def indexes @indexes end |
Instance Method Details
#index(columns, options = {}) ⇒ Object
120 121 122 123 |
# File 'lib/fast_change_table/fast_change_table.rb', line 120 def index(columns, = {}) new_index = PhoneyIndex.new(@table, columns, ) @indexes << new_index unless @indexes.to_a.any? {|i| i == new_index} end |