Class: Usher::Node::Response

Inherits:
Struct
  • Object
show all
Defined in:
lib/usher/node/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#matched_pathObject

Returns the value of attribute matched_path

Returns:

  • (Object)

    the current value of matched_path



3
4
5
# File 'lib/usher/node/response.rb', line 3

def matched_path
  @matched_path
end

#only_trailing_delimitersObject

Returns the value of attribute only_trailing_delimiters.



5
6
7
# File 'lib/usher/node/response.rb', line 5

def only_trailing_delimiters
  @only_trailing_delimiters
end

#params_as_arrayObject

Returns the value of attribute params_as_array

Returns:

  • (Object)

    the current value of params_as_array



3
4
5
# File 'lib/usher/node/response.rb', line 3

def params_as_array
  @params_as_array
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



3
4
5
# File 'lib/usher/node/response.rb', line 3

def path
  @path
end

#remaining_pathObject

Returns the value of attribute remaining_path

Returns:

  • (Object)

    the current value of remaining_path



3
4
5
# File 'lib/usher/node/response.rb', line 3

def remaining_path
  @remaining_path
end

Instance Method Details

#destinationObject



19
20
21
# File 'lib/usher/node/response.rb', line 19

def destination
  path && path.route.destination
end

#paramsObject



7
8
9
# File 'lib/usher/node/response.rb', line 7

def params
  @params ||= path.convert_params_array(params_as_array)
end

#params_as_hashObject



15
16
17
# File 'lib/usher/node/response.rb', line 15

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:

  • (Boolean)


11
12
13
# File 'lib/usher/node/response.rb', line 11

def partial_match?
  !remaining_path.nil?
end