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

Instance Method Details

#actionsObject



15
16
17
# File 'lib/degica/actionable.rb', line 15

def actions
  []
end

#describeObject



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

#promptObject

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