Class: Inflect::Request
- Inherits:
-
Object
- Object
- Inflect::Request
- Defined in:
- lib/inflect/request.rb
Overview
Class that parses the incoming data and builds the semantics around the request.
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#query_words ⇒ Object
readonly
Returns the value of attribute query_words.
Instance Method Summary collapse
-
#initialize(words) ⇒ Request
constructor
The request is built from an array of words.
Constructor Details
#initialize(words) ⇒ Request
The request is built from an array of words. Depending on the size the arguments and the action are built in a different ways.
15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/inflect/request.rb', line 5 def action @action end |
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
5 6 7 |
# File 'lib/inflect/request.rb', line 5 def arguments @arguments end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
5 6 7 |
# File 'lib/inflect/request.rb', line 5 def keyword @keyword end |
#query_words ⇒ Object (readonly)
Returns the value of attribute query_words.
5 6 7 |
# File 'lib/inflect/request.rb', line 5 def query_words @query_words end |