Class: HyperRouter::Location

Inherits:
Object
  • Object
show all
Includes:
Native
Defined in:
lib/hyper-router/location.rb

Instance Method Summary collapse

Constructor Details

#initialize(native) ⇒ Location

Returns a new instance of Location.



5
6
7
# File 'lib/hyper-router/location.rb', line 5

def initialize(native)
  @native = native
end

Instance Method Details

#queryObject



13
14
15
16
17
18
19
20
21
# File 'lib/hyper-router/location.rb', line 13

def query
  return {} if search.blank?

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

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

#to_nObject



9
10
11
# File 'lib/hyper-router/location.rb', line 9

def to_n
  @native
end