Method: NoBrainer::Lock#initialize
- Defined in:
- lib/no_brainer/lock.rb
#initialize(key, options = {}) ⇒ Lock
Returns a new instance of Lock.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/no_brainer/lock.rb', line 21 def initialize(key, ={}) if [:from_db] super # We reset our instance_token to allow recoveries. self.instance_token = get_new_instance_token else = .slice(:expire, :timeout) .delete(:expire); .delete(:timeout); key = key.to_s if key.is_a?(Symbol) super(.merge(:key => key)) raise ArgumentError unless valid? end end |