module Gamefic::Scriptable::Responses
def meta verb, *args, &proc
-
(Response)
-
Other tags:
- Yieldparam: -
Parameters:
-
args
(Array
) -- Filters for the command's tokens -
verb
(Symbol, String, nil
) -- An imperative verb for the command
def meta verb, *args, &proc response = Response.new(verb&.to_sym, *args, meta: true, &proc) responses.push response syntaxes.push response.syntax response end
def respond verb, *args, &proc
-
(Response)
-
Other tags:
- Yieldparam: -
Parameters:
-
args
(Array
) -- Filters for the command's tokens -
verb
(Symbol, String, nil
) -- An imperative verb for the command
Other tags:
- Example: A Response that accepts a Character -
Example: A simple Response. -
def respond verb, *args, &proc response = Response.new(verb&.to_sym, *args, &proc) responses.push response syntaxes.push response.syntax response end
def responses
-
(Array
-)
def responses @responses ||= [] end
def responses_for(*verbs)
-
(Array
-)
def responses_for(*verbs) symbols = verbs.map { |verb| verb&.to_sym } responses.select { |response| symbols.include? response.verb } end
def verbs
-
(Array
-)
def verbs responses.select(&:verb).uniq(&:verb) end