From d9f200f2fb14907137a27d5c9522575274bb0cde Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Fri, 11 Jan 2008 00:05:22 -0800 Subject: minor cleanup - using a struct, a bit more terse --- lib/active_relation/relations/base.rb | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/active_relation/relations/base.rb b/lib/active_relation/relations/base.rb index c4a887eecd..67a64b9aa6 100644 --- a/lib/active_relation/relations/base.rb +++ b/lib/active_relation/relations/base.rb @@ -38,8 +38,8 @@ module ActiveRelation Predicates::RelationInclusion.new(attribute, self) end - def select(*s) - Selection.new(self, *s) + def select(*predicates) + Selection.new(self, *predicates) end def project(*attributes) @@ -62,21 +62,10 @@ module ActiveRelation Deletion.new(self) end - class JoinOperation - attr_reader :join_sql, :relation1, :relation2 - - def initialize(join_sql, relation1, relation2) - @join_sql, @relation1, @relation2 = join_sql, relation1, relation2 - end - + JoinOperation = Struct.new(:join_sql, :relation1, :relation2) do def on(*predicates) Join.new(join_sql, relation1, relation2, *predicates) end - - def ==(other) - (relation1 == other.relation1 and relation2 == other.relation2) or - (relation1 == other.relation2 and relation2 == other.relation1) - end end end include Operations -- cgit v1.2.3