Class: FastChangeTable::InstanceMethods::PhoneyTable

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_change_table/fast_change_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#indexesObject

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, options = {})
  new_index = PhoneyIndex.new(@table, columns, options)
  @indexes << new_index unless @indexes.to_a.any? {|i| i == new_index}
end