Module: Lockable
Overview
A module for entities that are both openable and lockable.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Openable
#accessible?, #closed?, #open?
Instance Attribute Details
#lock_key ⇒ Object
Returns the value of attribute lock_key.
10
11
12
|
# File 'lib/gamefic-standard/lockable.rb', line 10
def lock_key
@lock_key
end
|
Instance Method Details
#lock_key? ⇒ Boolean
Also known as:
has_lock_key?
32
33
34
|
# File 'lib/gamefic-standard/lockable.rb', line 32
def lock_key?
!@lock_key.nil?
end
|
#locked=(bool) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/gamefic-standard/lockable.rb', line 12
def locked=(bool)
@locked = bool
if @locked == true
self.open = false
end
end
|
#locked? ⇒ Boolean
24
25
26
|
# File 'lib/gamefic-standard/lockable.rb', line 24
def locked?
@locked ||= false
end
|
#open=(bool) ⇒ Object
19
20
21
22
|
# File 'lib/gamefic-standard/lockable.rb', line 19
def open=(bool)
@open = bool
@locked = false if @open == true
end
|
#unlocked? ⇒ Boolean
28
29
30
|
# File 'lib/gamefic-standard/lockable.rb', line 28
def unlocked?
!locked?
end
|