Module: ActsAsLockable::Lockable

Defined in:
lib/acts_as_lockable/lockable.rb

Instance Method Summary collapse

Instance Method Details

#is_locked?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/acts_as_lockable/lockable.rb', line 3

def is_locked?
  !self.locker.nil?
end

#lockObject



7
8
9
10
# File 'lib/acts_as_lockable/lockable.rb', line 7

def lock
  self.create_locker(locked_type: self.model_name.name) if self.locker.nil?
  return true
end

#unlockObject



12
13
14
# File 'lib/acts_as_lockable/lockable.rb', line 12

def unlock
  self.locker.destroy
end