Class: Radventure::Room
- Inherits:
-
Object
- Object
- Radventure::Room
- Defined in:
- lib/radventure/room.rb
Instance Attribute Summary collapse
-
#down ⇒ Object
Returns the value of attribute down.
-
#east ⇒ Object
Returns the value of attribute east.
-
#inside ⇒ Object
Returns the value of attribute inside.
-
#is_lit ⇒ Object
readonly
Returns the value of attribute is_lit.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#north ⇒ Object
Returns the value of attribute north.
-
#northeast ⇒ Object
Returns the value of attribute northeast.
-
#northwest ⇒ Object
Returns the value of attribute northwest.
-
#outside ⇒ Object
Returns the value of attribute outside.
-
#south ⇒ Object
Returns the value of attribute south.
-
#southeast ⇒ Object
Returns the value of attribute southeast.
-
#southwest ⇒ Object
Returns the value of attribute southwest.
-
#up ⇒ Object
Returns the value of attribute up.
-
#west ⇒ Object
Returns the value of attribute west.
Instance Method Summary collapse
-
#description(darkvision: false) ⇒ String
The description of the room.
-
#initialize(name, description, is_lit: true) ⇒ Room
constructor
Constructor method.
-
#name(darkvision: false) ⇒ String
The name of the room.
Constructor Details
#initialize(name, description, is_lit: true) ⇒ Room
Constructor method
15 16 17 18 19 20 |
# File 'lib/radventure/room.rb', line 15 def initialize(name, description, is_lit: true) @name = name.strip @description = description.strip @is_lit = is_lit ? true : false @items = [] end |
Instance Attribute Details
#down ⇒ Object
Returns the value of attribute down.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def down @down end |
#east ⇒ Object
Returns the value of attribute east.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def east @east end |
#inside ⇒ Object
Returns the value of attribute inside.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def inside @inside end |
#is_lit ⇒ Object (readonly)
Returns the value of attribute is_lit.
5 6 7 |
# File 'lib/radventure/room.rb', line 5 def is_lit @is_lit end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
5 6 7 |
# File 'lib/radventure/room.rb', line 5 def items @items end |
#north ⇒ Object
Returns the value of attribute north.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def north @north end |
#northeast ⇒ Object
Returns the value of attribute northeast.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def northeast @northeast end |
#northwest ⇒ Object
Returns the value of attribute northwest.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def northwest @northwest end |
#outside ⇒ Object
Returns the value of attribute outside.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def outside @outside end |
#south ⇒ Object
Returns the value of attribute south.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def south @south end |
#southeast ⇒ Object
Returns the value of attribute southeast.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def southeast @southeast end |
#southwest ⇒ Object
Returns the value of attribute southwest.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def southwest @southwest end |
#up ⇒ Object
Returns the value of attribute up.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def up @up end |
#west ⇒ Object
Returns the value of attribute west.
6 7 8 |
# File 'lib/radventure/room.rb', line 6 def west @west end |
Instance Method Details
#description(darkvision: false) ⇒ String
The description of the room
36 37 38 39 40 41 42 |
# File 'lib/radventure/room.rb', line 36 def description(darkvision: false) if @is_lit || darkvision @description else 'The room is in total darkness and you cannot see a thing.' end end |
#name(darkvision: false) ⇒ String
The name of the room
25 26 27 28 29 30 31 |
# File 'lib/radventure/room.rb', line 25 def name(darkvision: false) if @is_lit || darkvision @name else 'Darkness' end end |