diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 17:26:06 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 17:26:06 -0700 |
commit | 9d07043eceab33113f55a6e8cb12f9f6ad296f5c (patch) | |
tree | 7fa0346bb95a0d4c8e2b083abe87f5df170fb2ac /lib/arel/algebra/relations/operations/lock.rb | |
parent | 3ae0cdf21980e454b1fdaf6005179080c0114c27 (diff) | |
download | rails-9d07043eceab33113f55a6e8cb12f9f6ad296f5c.tar.gz rails-9d07043eceab33113f55a6e8cb12f9f6ad296f5c.tar.bz2 rails-9d07043eceab33113f55a6e8cb12f9f6ad296f5c.zip |
removing more metaprogramming
Diffstat (limited to 'lib/arel/algebra/relations/operations/lock.rb')
-rw-r--r-- | lib/arel/algebra/relations/operations/lock.rb | 12 |
1 files changed, 8 insertions, 4 deletions
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 - |