Class: James::Inputs::Base
- Inherits:
-
Object
- Object
- James::Inputs::Base
- Defined in:
- lib/james/inputs/base.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#heard(command) ⇒ Object
Call this method if you heard something in the subclass.
-
#initialize(controller) ⇒ Base
constructor
A new instance of Base.
-
#show_possibilities(possibilities) ⇒ Object
Shows possible commands in the terminal.
Constructor Details
#initialize(controller) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/james/inputs/base.rb', line 9 def initialize controller @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
7 8 9 |
# File 'lib/james/inputs/base.rb', line 7 def controller @controller end |
Instance Method Details
#heard(command) ⇒ Object
Call this method if you heard something in the subclass.
15 16 17 |
# File 'lib/james/inputs/base.rb', line 15 def heard command controller.hear command end |
#show_possibilities(possibilities) ⇒ Object
Shows possible commands in the terminal.
21 22 23 24 25 26 |
# File 'lib/james/inputs/base.rb', line 21 def show_possibilities possibilities puts "Possibilities:\n" possibilities.each_with_index do |possibility, index| puts "#{index + 1}) #{possibility}" end end |