Class: Degica::Room
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#doors ⇒ Object
Returns the value of attribute doors.
Instance Method Summary collapse
- #actions ⇒ Object
- #describe ⇒ Object
- #generate! ⇒ Object
-
#initialize(description, objects = []) ⇒ Room
constructor
A new instance of Room.
Methods included from Actionable
Constructor Details
#initialize(description, objects = []) ⇒ Room
Returns a new instance of Room.
6 7 8 9 10 11 |
# File 'lib/degica/room.rb', line 6 def initialize(description, objects = []) @description = description.highlight @doors = DoorCollection.new @objects = ObjectCollection.new(objects) @generated = false end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/degica/room.rb', line 4 def description @description end |
#doors ⇒ Object
Returns the value of attribute doors.
4 5 6 |
# File 'lib/degica/room.rb', line 4 def doors @doors end |
Instance Method Details
#actions ⇒ Object
24 25 26 27 28 29 |
# File 'lib/degica/room.rb', line 24 def actions actions = @doors.actions + @objects.actions actions << Action.new(:room, self) actions << Action.new(:door, @doors.first) if @doors.size == 1 actions end |
#describe ⇒ Object
31 32 33 |
# File 'lib/degica/room.rb', line 31 def describe @description end |