Sha256: 091dee00151515ecb720724f0f97853a6ead466c2c63f37cfb15df394e55365b

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

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

      attr_accessor :only_trailing_delimiters
      
      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.7.4 lib/usher/node/response.rb
usher-0.7.3 lib/usher/node/response.rb
usher-0.7.2 lib/usher/node/response.rb