Class: Arel::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/arel/algebra/relations/row.rb

Instance Method Summary collapse

Instance Method Details

#[](attribute) ⇒ Object



6
7
8
# File 'lib/arel/algebra/relations/row.rb', line 6

def [](attribute)
  attribute.type_cast(tuple[relation.position_of(attribute)])
end

#bind(relation) ⇒ Object



18
19
20
# File 'lib/arel/algebra/relations/row.rb', line 18

def bind(relation)
  Row.new(relation, tuple)
end

#combine(other, relation) ⇒ Object



22
23
24
# File 'lib/arel/algebra/relations/row.rb', line 22

def combine(other, relation)
  Row.new(relation, tuple + other.tuple)
end

#slice(*attributes) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/arel/algebra/relations/row.rb', line 10

def slice(*attributes)
  Row.new(relation, attributes.inject([]) do |cheese, attribute|
    # FIXME TESTME method chaining
    cheese << tuple[relation.relation.position_of(attribute)]
    cheese
  end)
end