Class: Usher::Node::Response
- Inherits:
-
Struct
- Object
- Struct
- Usher::Node::Response
- Defined in:
- lib/usher/node/response.rb
Overview
The response from Usher::Node::Root#lookup. Adds some convenience methods for common parameter manipulation.
Instance Attribute Summary collapse
-
#matched_path ⇒ Object
Returns the value of attribute matched_path.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#only_trailing_delimiters ⇒ Object
Returns the value of attribute only_trailing_delimiters.
-
#params_as_array ⇒ Object
Returns the value of attribute params_as_array.
-
#path ⇒ Object
Returns the value of attribute path.
-
#remaining_path ⇒ Object
Returns the value of attribute remaining_path.
Instance Method Summary collapse
-
#destination ⇒ Object
The destination assigned to the matching enclosed path.
-
#params ⇒ Array<Symbol, String>
The params from recognition.
-
#params_as_hash ⇒ Hash<Symbol, String>
The params from recognition.
-
#partial_match? ⇒ Boolean
The state of partial matching.
-
#succeeded? ⇒ Boolean
The success of the response.
Instance Attribute Details
#matched_path ⇒ Object
Returns the value of attribute matched_path
4 5 6 |
# File 'lib/usher/node/response.rb', line 4 def matched_path @matched_path end |
#meta ⇒ Object
Returns the value of attribute meta
4 5 6 |
# File 'lib/usher/node/response.rb', line 4 def @meta end |
#only_trailing_delimiters ⇒ Object
Returns the value of attribute only_trailing_delimiters
4 5 6 |
# File 'lib/usher/node/response.rb', line 4 def only_trailing_delimiters @only_trailing_delimiters end |
#params_as_array ⇒ Object
Returns the value of attribute params_as_array
4 5 6 |
# File 'lib/usher/node/response.rb', line 4 def params_as_array @params_as_array end |
#path ⇒ Object
Returns the value of attribute path
4 5 6 |
# File 'lib/usher/node/response.rb', line 4 def path @path end |
#remaining_path ⇒ Object
Returns the value of attribute remaining_path
4 5 6 |
# File 'lib/usher/node/response.rb', line 4 def remaining_path @remaining_path end |
Instance Method Details
#destination ⇒ Object
Returns The destination assigned to the matching enclosed path.
30 31 32 |
# File 'lib/usher/node/response.rb', line 30 def destination path && path.route.destination end |
#params ⇒ Array<Symbol, String>
The params from recognition
14 15 16 |
# File 'lib/usher/node/response.rb', line 14 def params @params ||= path.convert_params_array(params_as_array) end |
#params_as_hash ⇒ Hash<Symbol, String>
The params from recognition
25 26 27 |
# File 'lib/usher/node/response.rb', line 25 def params_as_hash @params_as_hash ||= params_as_array.inject({}){|hash, val| hash[path.dynamic_keys[hash.size]] = val; hash} end |
#partial_match? ⇒ Boolean
Returns The state of partial matching.
19 20 21 |
# File 'lib/usher/node/response.rb', line 19 def partial_match? !remaining_path.nil? end |
#succeeded? ⇒ Boolean
The success of the response
8 9 10 |
# File 'lib/usher/node/response.rb', line 8 def succeeded? true end |