blob: 3731dd96962acf50064595ad59c1944a7313b257 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
module Arel
class Row
attributes :relation, :tuple
deriving :==, :initialize
def [](attribute)
tuple[relation.position_of(attribute)]
end
def slice(*attributes)
Row.new(relation, attributes.inject([]) do |cheese, attribute|
cheese << self[attribute]
cheese
end)
end
def bind(relation)
Row.new(relation, tuple)
end
def combine(other, relation)
Row.new(relation, tuple + other.tuple)
end
end
end
|