class Gamefic::Order


generating actions to be executed in the Dispatcher.
The Active#execute method uses Order to bypass the parser while
Build actions from explicit verbs and arguments.

def initialize(actor, verb, arguments)

Parameters:
  • arguments (Array) --
  • verb (Symbol) --
  • actor (Actor) --
  • def initialize(actor, verb, arguments)
      @actor = actor
      @verb = verb
      @arguments = arguments
    end

    def match_arguments(response)

    def match_arguments(response)
      return nil if response.queries.length != arguments.length
      matches = response.queries.zip(arguments).each_with_object([]) do |zipped, result|
        query, param = zipped
        return nil unless query.accept?(actor, param)
        result.push Match.new(param, param, 1000)
      end
      Action.new(actor, response, matches, nil)
    end

    def to_actions

    Returns:
    • (Array) -
    def to_actions
      Action.sort(
        actor.narratives
            .responses_for(verb)
            .map { |response| match_arguments(response) }
            .compact
      )
    end