Sha256: c4e7949fe9cf0d9d1c21e800c48c4f4649c82945a3e958e5eacbf4a442a23b34
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
class Usher class Node # The response from {Usher::Node::Root#lookup}. Adds some convenience methods for common parameter manipulation. class Response < Struct.new(:path, :params_as_array, :remaining_path, :matched_path, :only_trailing_delimiters, :meta) # The success of the response # @return [Boolean] Always returns true def succeeded? true end # The params from recognition # @return [Array<Symbol, String>] The parameters detected from recognition returned as an array of arrays. def params @params ||= path.convert_params_array(params_as_array) end # @return [Boolean] The state of partial matching def partial_match? !remaining_path.nil? end # The params from recognition # @return [Hash<Symbol, String>] The parameters detected from recognition returned as a hash. def params_as_hash @params_as_hash ||= params_as_array.inject({}){|hash, val| hash[path.dynamic_keys[hash.size]] = val; hash} end # @return [Object] The destination assigned to the matching enclosed path. def destination path && path.route.destination end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
usher-0.8.3 | lib/usher/node/response.rb |
usher-0.8.2 | lib/usher/node/response.rb |
usher-0.8.1 | lib/usher/node/response.rb |