class ActiveRecord::Result::IndexedRow

def ==(other)

def ==(other)
  if other.is_a?(Hash)
    to_hash == other
  else
    super
  end
end

def [](column)

def [](column)
  if index = @column_indexes[column]
    @row[index]
  end
end

def each_key(&block)

def each_key(&block)
  @column_indexes.each_key(&block)
end

def fetch(column)

def fetch(column)
  if index = @column_indexes[column]
    @row[index]
  elsif block_given?
    yield
  else
    raise KeyError, "key not found: #{column.inspect}"
  end
end

def initialize(column_indexes, row)

def initialize(column_indexes, row)
  @column_indexes = column_indexes
  @row = row
end

def key?(column)

def key?(column)
  @column_indexes.key?(column)
end

def keys

def keys
  @column_indexes.keys
end

def size

def size
  @column_indexes.size
end

def to_h

def to_h
  @column_indexes.transform_values { |index| @row[index] }
end