Sha256: 3b68a52113250e0152abc91e7314755f2661a0f20c80e7eea8e3fed3927f7418

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

module Hyperstack
  module Router
    class Location
      include Native

      def initialize(native)
        @native = native
      end

      def to_n
        @native
      end

      def query
        return {} if search.blank?

        Hash[search[1..-1].split('&').map { |part|
          name, value = part.split('=')

          [`decodeURIComponent(#{name})`, `decodeURIComponent(#{value})`]
        }]
      end

      alias_native :pathname
      alias_native :search
      alias_native :hash
      alias_native :state
      alias_native :key
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyper-router-1.0.alpha1.5 lib/hyperstack/router/location.rb
hyper-router-1.0.alpha1.4 lib/hyperstack/router/location.rb
hyper-router-1.0.alpha1.3 lib/hyperstack/router/location.rb
hyper-router-1.0.alpha1.2 lib/hyperstack/router/location.rb
hyper-router-1.0.alpha1.1 lib/hyperstack/router/location.rb
hyper-router-1.0.alpha1 lib/hyperstack/router/location.rb