Exception: Locksy::LockNotOwnedError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Locksy::LockNotOwnedError
- Defined in:
- lib/locksy/errors.rb
Instance Attribute Summary collapse
-
#current_expiry ⇒ Object
readonly
Returns the value of attribute current_expiry.
-
#current_owner ⇒ Object
readonly
Returns the value of attribute current_owner.
-
#lock ⇒ Object
readonly
Returns the value of attribute lock.
Instance Method Summary collapse
-
#initialize(msg = nil, lock:, current_owner: nil, current_expiry: nil) ⇒ LockNotOwnedError
constructor
A new instance of LockNotOwnedError.
Constructor Details
#initialize(msg = nil, lock:, current_owner: nil, current_expiry: nil) ⇒ LockNotOwnedError
Returns a new instance of LockNotOwnedError.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/locksy/errors.rb', line 5 def initialize(msg = nil, lock:, current_owner: nil, current_expiry: nil) @lock = lock @current_owner = current_owner @current_expiry = current_expiry if msg.nil? msg = "Unable to manipulate lock #{lock.lock_name} for #{lock.owner}." msg += " Lock currently owned by #{current_owner}." if current_owner msg += " Lock unnavailable until #{current_expiry}." if current_expiry end super msg end |
Instance Attribute Details
#current_expiry ⇒ Object (readonly)
Returns the value of attribute current_expiry.
3 4 5 |
# File 'lib/locksy/errors.rb', line 3 def current_expiry @current_expiry end |
#current_owner ⇒ Object (readonly)
Returns the value of attribute current_owner.
3 4 5 |
# File 'lib/locksy/errors.rb', line 3 def current_owner @current_owner end |
#lock ⇒ Object (readonly)
Returns the value of attribute lock.
3 4 5 |
# File 'lib/locksy/errors.rb', line 3 def lock @lock end |