Sha256: 27fe5c15e7c0d9bb6a0b78ff56b572217046b65a001eb6285b8babe70e448f6a

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

class Usher
  class Node
    class Response < Struct.new(:path, :params_as_array, :remaining_path, :matched_path)

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

      def partial_match?
        !remaining_path.nil?
      end

      def params_as_hash
        @params_as_hash ||= params_as_array.inject({}){|hash, val| hash[path.dynamic_keys[hash.size]] = val; hash}
      end

      def destination
        path && path.route.destination
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
usher-0.6.8 lib/usher/node/response.rb
usher-0.6.7 lib/usher/node/response.rb
usher-0.6.6 lib/usher/node/response.rb