aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/operations/lock.rb
blob: 003bd29c8ad3290a95e248ec408fb025cf994edd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Arel
  class Lock < Compound
    attr_reader :locked

    def initialize(relation, locked)
      super(relation)
      @locked   = locked.blank? ? " FOR UPDATE" : locked
    end

    def == other
      super || Lock === other &&
               relation == other.relation &&
               locked == other.locked
    end
  end
end