Class: Rubinstein::World
- Inherits:
-
Object
- Object
- Rubinstein::World
- Defined in:
- lib/rubinstein/world.rb
Instance Attribute Summary collapse
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#name ⇒ Object
Returns the value of attribute name.
-
#player ⇒ Object
Returns the value of attribute player.
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ World
constructor
A new instance of World.
- #location(name, &block) ⇒ Object
- #start(location) ⇒ Object
Constructor Details
Instance Attribute Details
#locations ⇒ Object
Returns the value of attribute locations.
4 5 6 |
# File 'lib/rubinstein/world.rb', line 4 def locations @locations end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/rubinstein/world.rb', line 4 def name @name end |
#player ⇒ Object
Returns the value of attribute player.
4 5 6 |
# File 'lib/rubinstein/world.rb', line 4 def player @player end |
Instance Method Details
#location(name, &block) ⇒ Object
14 15 16 |
# File 'lib/rubinstein/world.rb', line 14 def location(name,&block) @locations[name] = Location.new(name,&block) end |
#start(location) ⇒ Object
18 19 20 |
# File 'lib/rubinstein/world.rb', line 18 def start(location) @player.location = @locations[location] end |