module Gamefic::Scriptable::Responses

def meta verb, *args, &proc

Returns:
  • (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

    Returns:
    • (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

      Returns:
      • (Array) -
      def responses
        @responses ||= []
      end

      def responses_for(*verbs)

      Returns:
      • (Array) -
      def responses_for(*verbs)
        symbols = verbs.map { |verb| verb&.to_sym }
        responses.select { |response| symbols.include? response.verb }
      end

      def verbs

      Returns:
      • (Array) -
      def verbs
        responses.select(&:verb).uniq(&:verb)
      end