Sha256: 2f586a9c6412e385b0fb7f25482c1f2a45ad06cf0b3845abde7b55c451cd681c

Contents?: true

Size: 566 Bytes

Versions: 2

Compression:

Stored size: 566 Bytes

Contents

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

      def params
        @params ||= params_as_array.nil? ? [] : 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.nil? ? {} : 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

2 entries across 2 versions & 1 rubygems

Version Path
usher-0.6.5 lib/usher/node/response.rb
usher-0.6.4 lib/usher/node/response.rb