class Perpetuity::Postgres::IndexCollection

Attributes

table[R]

Public Class Methods

new(table, *indexes) click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 10
def initialize table, *indexes
  @table = table.to_s
  @indexes = indexes.flatten.to_set
end

Public Instance Methods

-(other) click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 35
def - other
  difference = self.class.new(table)
  each do |index|
    unless other.include? index
      difference << index
    end
  end

  difference
end
<<(index) click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 15
def << index
  @indexes << index
end
==(other) click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 46
def == other
  table == other.table &&
  count == other.count &&
  (self - other).empty?
end
each() { |index| ... } click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 19
def each
  @indexes.each { |index| yield index }
end
reject!(&block) click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 23
def reject! &block
  @indexes.reject!(&block)
end
to_a() click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 27
def to_a
  @indexes.to_a
end
to_ary() click to toggle source
# File lib/perpetuity/postgres/index_collection.rb, line 31
def to_ary
  to_a
end