Module: HyperRouter::ClassMethods

Defined in:
lib/hyper-router/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#history(*args) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/hyper-router/class_methods.rb', line 5

def history(*args)
  if args.count > 0
    @__history_type = args.first
  elsif @__history_type
    @__history ||= send(:"#{@__history_type}_history")
  end
end

#locationObject



13
14
15
# File 'lib/hyper-router/class_methods.rb', line 13

def location
  @__location ||= Location.new(`#{history.to_n}.location`)
end

#route(&block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/hyper-router/class_methods.rb', line 17

def route(&block)
  if React::IsomorphicHelpers.on_opal_server?
    prerender_router(&block)
  else
    render_router(&block)
  end
end