From 12859b89e574a2965ae94053dc0cdaf92dcf8e3a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 25 Jul 2010 17:59:26 -0700 Subject: more unfactoring --- lib/arel/algebra/relations/row.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/arel/algebra') diff --git a/lib/arel/algebra/relations/row.rb b/lib/arel/algebra/relations/row.rb index 3158557448..f5fe364b83 100644 --- a/lib/arel/algebra/relations/row.rb +++ b/lib/arel/algebra/relations/row.rb @@ -1,7 +1,18 @@ module Arel class Row - attributes :relation, :tuple - deriving :==, :initialize + attr_reader :tuple, :relation + + def initialize relation, tuple + @relation = relation + @tuple = tuple + end + + def == other + super || + Row === other && + relation == other.relation && + tuple == other.tuple + end def [](attribute) attribute.type_cast(tuple[relation.position_of(attribute)]) -- cgit v1.2.3