Sha256: 02b7d9fa06ce9a88dde2e66d26235275dc000d93af1b6e0ae1c9021f91f74359

Contents?: true

Size: 508 Bytes

Versions: 16

Compression:

Stored size: 508 Bytes

Contents

module HyperRouter
  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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
hyper-router-0.99.6 lib/hyper-router/location.rb
hyper-router-0.99.5 lib/hyper-router/location.rb
hyper-router-0.99.4 lib/hyper-router/location.rb
hyper-router-0.99.3 lib/hyper-router/location.rb
hyper-router-0.99.2 lib/hyper-router/location.rb
hyper-router-0.99.1 lib/hyper-router/location.rb
hyper-router-4.2.6.lap28 lib/hyper-router/location.rb
hyper-router-4.2.6.lap27 lib/hyper-router/location.rb
hyper-router-4.2.6.lap26 lib/hyper-router/location.rb
hyper-router-4.2.6.lap25 lib/hyper-router/location.rb
hyper-router-4.2.6.lap24 lib/hyper-router/location.rb
hyper-router-4.2.6.lap23 lib/hyper-router/location.rb
hyper-router-4.2.6.lap22 lib/hyper-router/location.rb
hyper-router-4.1.1 lib/hyper-router/location.rb
hyper-router-4.0.1 lib/hyper-router/location.rb
hyper-router-4.0.0 lib/hyper-router/location.rb