Class: Rubyquest::CLI
- Inherits:
-
Object
- Object
- Rubyquest::CLI
- Defined in:
- lib/rubyquest/cli.rb
Instance Attribute Summary collapse
-
#hero ⇒ Object
readonly
Returns the value of attribute hero.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(input = ::Readline, output = Output) ⇒ CLI
constructor
A new instance of CLI.
- #start! ⇒ Object
Constructor Details
#initialize(input = ::Readline, output = Output) ⇒ CLI
Returns a new instance of CLI.
11 12 13 |
# File 'lib/rubyquest/cli.rb', line 11 def initialize input = ::Readline, output = Output @input, @output = input, output end |
Instance Attribute Details
#hero ⇒ Object (readonly)
Returns the value of attribute hero.
9 10 11 |
# File 'lib/rubyquest/cli.rb', line 9 def hero @hero end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
9 10 11 |
# File 'lib/rubyquest/cli.rb', line 9 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
9 10 11 |
# File 'lib/rubyquest/cli.rb', line 9 def output @output end |
Instance Method Details
#start! ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rubyquest/cli.rb', line 15 def start! greetings # Leave the game without a Ruby exception upon interruption trap(:INT) { puts; exit } set_user console end |