Module: Degica::Actionable
- Included in:
- Actor, Collection, Door, NilActionable, Object, Room
- Defined in:
- lib/degica/actionable.rb
Overview
Allows objects to be actionable in the game REPL. Actionable objects can be focused, described, and can expose actions in the REPL.
Instance Method Summary collapse
- #actions ⇒ Object
- #describe ⇒ Object
- #do(name, *args) ⇒ Object
-
#prompt ⇒ Object
Customized REPL prompt for action.
Instance Method Details
#actions ⇒ Object
15 16 17 |
# File 'lib/degica/actionable.rb', line 15 def actions [] end |
#describe ⇒ Object
20 21 22 |
# File 'lib/degica/actionable.rb', line 20 def describe nil end |
#do(name, *args) ⇒ Object
24 25 26 |
# File 'lib/degica/actionable.rb', line 24 def do(name, *args) actions.find { |action| action.name == name }.do(*args) end |
#prompt ⇒ Object
Customized REPL prompt for action. For example, if the prompt method returned “book”
book> ...
10 11 12 |
# File 'lib/degica/actionable.rb', line 10 def prompt nil end |