From 9d07043eceab33113f55a6e8cb12f9f6ad296f5c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 25 Jul 2010 17:26:06 -0700 Subject: removing more metaprogramming --- lib/arel/algebra/relations/operations/lock.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/arel/algebra') diff --git a/lib/arel/algebra/relations/operations/lock.rb b/lib/arel/algebra/relations/operations/lock.rb index 4520fd668b..003bd29c8a 100644 --- a/lib/arel/algebra/relations/operations/lock.rb +++ b/lib/arel/algebra/relations/operations/lock.rb @@ -1,12 +1,16 @@ module Arel class Lock < Compound - attributes :relation, :locked - deriving :== + attr_reader :locked def initialize(relation, locked) - @relation = relation + super(relation) @locked = locked.blank? ? " FOR UPDATE" : locked end + + def == other + super || Lock === other && + relation == other.relation && + locked == other.locked + end end end - -- cgit v1.2.3