diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 17:59:26 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 17:59:26 -0700 |
commit | 12859b89e574a2965ae94053dc0cdaf92dcf8e3a (patch) | |
tree | 9cd23701f1f989160b1ec3e9d8c48d24b7e1a000 | |
parent | 496134516e19acd93772cfff8eafa4cb2dd8bc8d (diff) | |
download | rails-12859b89e574a2965ae94053dc0cdaf92dcf8e3a.tar.gz rails-12859b89e574a2965ae94053dc0cdaf92dcf8e3a.tar.bz2 rails-12859b89e574a2965ae94053dc0cdaf92dcf8e3a.zip |
more unfactoring
-rw-r--r-- | lib/arel/algebra/relations/row.rb | 15 |
1 files changed, 13 insertions, 2 deletions
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)]) |