Class: Rubyquest::Command
- Inherits:
-
Object
- Object
- Rubyquest::Command
- Defined in:
- lib/rubyquest/command.rb
Constant Summary collapse
- COMMANDS =
[ 'go to <place>', 'help', 'exit' ]
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(string, hero = nil) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(string, hero = nil) ⇒ Command
Returns a new instance of Command.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rubyquest/command.rb', line 15 def initialize string, hero = nil case string when /^help$/ help when /^exit$/ nil when /^quests$/ Quest.load when /^go to (\D*)$/ $1 go $1, hero.map else invalid string end end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/rubyquest/command.rb', line 7 def output @output end |