Class: Den_east
- Inherits:
-
Object
- Object
- Den_east
- Defined in:
- lib/denofshadows.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#inventory ⇒ Object
Returns the value of attribute inventory.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name = 'eastern cavern', commands = ['look', 'take', 'leave'], inventory = ['club', 'wicker shield']) ⇒ Den_east
constructor
A new instance of Den_east.
- #introduction ⇒ Object
- #leave ⇒ Object
- #look ⇒ Object
Constructor Details
#initialize(name = 'eastern cavern', commands = ['look', 'take', 'leave'], inventory = ['club', 'wicker shield']) ⇒ Den_east
Returns a new instance of Den_east.
140 141 142 143 144 |
# File 'lib/denofshadows.rb', line 140 def initialize(name = 'eastern cavern', commands = ['look', 'take', 'leave'], inventory = ['club', 'wicker shield']) @name = name @commands = commands @inventory = inventory end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
138 139 140 |
# File 'lib/denofshadows.rb', line 138 def commands @commands end |
#inventory ⇒ Object
Returns the value of attribute inventory.
138 139 140 |
# File 'lib/denofshadows.rb', line 138 def inventory @inventory end |
#name ⇒ Object
Returns the value of attribute name.
138 139 140 |
# File 'lib/denofshadows.rb', line 138 def name @name end |
Instance Method Details
#introduction ⇒ Object
146 147 148 |
# File 'lib/denofshadows.rb', line 146 def introduction puts 'You walk into the small cavern.' end |
#leave ⇒ Object
157 158 159 |
# File 'lib/denofshadows.rb', line 157 def leave $player.position.delete_at (0) end |
#look ⇒ Object
151 152 153 154 155 |
# File 'lib/denofshadows.rb', line 151 def look puts 'On the floor before you lies a poorly made wicker shield.' if self.inventory.include? 'wicker shield' puts 'Leaning against the far wall is a crude looking club.' if self.inventory.include? 'club' puts 'The room is small and damp. There is nothing here of any interest.' if self.inventory.length == 0 end |