Sha256: b7e03402b73b7cd36eda2445f255fcf95322366668406ca1ab29fdb752ca7f39

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

class Usher
  class Node
    class Response < Struct.new(:path, :params_as_array, :remaining_path, :matched_path, :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

2 entries across 2 versions & 1 rubygems

Version Path
usher-0.7.1 lib/usher/node/response.rb
usher-0.7.0 lib/usher/node/response.rb