class Inflect::Request

Class that parses the incoming data and builds the semantics around the request.

Attributes

action[R]
arguments[R]
keyword[R]
query_words[R]

Public Class Methods

new(words) click to toggle source

The request is built from an array of words. Depending on the size the arguments and the action are built in a different ways. @example

%W[WEATHER] -> {service_key: weather, action: 'default'}
%W[WEATHER TODAY] -> {service_key: weather, action: 'today'}
%W[WEATHER TODAY BUENOS\ AIRES] -> {service_key: weather, action: 'today',
args: ['Buenos Aires']}
# File lib/inflect/request.rb, line 15
def initialize(words)
  @query_words = words.dup
  @keyword = words.shift
  @action = words.first.nil? ? :default : words.shift.downcase.to_sym
  @arguments = words.map(&:downcase)
end