Module: Mongoid::OptimisticLocking::ThreadedWithUnlocked::ClassMethods

Defined in:
lib/mongoid/optimistic_locking/threaded_with_unlocked.rb

Instance Method Summary collapse

Instance Method Details

#clear_options!Object



21
22
23
24
# File 'lib/mongoid/optimistic_locking/threaded_with_unlocked.rb', line 21

def clear_options!
  self.unlocked = false
  super
end

#optimistic_locking?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/mongoid/optimistic_locking/threaded_with_unlocked.rb', line 9

def optimistic_locking?
  !unlocked
end

#unlockedObject



13
14
15
# File 'lib/mongoid/optimistic_locking/threaded_with_unlocked.rb', line 13

def unlocked
  !!Thread.current["[mongoid]:unlocked"]
end

#unlocked=(value) ⇒ Object



17
18
19
# File 'lib/mongoid/optimistic_locking/threaded_with_unlocked.rb', line 17

def unlocked=(value)
  Thread.current["[mongoid]:unlocked"] = value
end