Class: Panda::Routing::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/panda/routing/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouter

Returns a new instance of Router.



6
7
8
# File 'lib/panda/routing/router.rb', line 6

def initialize
  @endpoints ||= Hash.new { |h, k| h[k] = [] }
end

Instance Attribute Details

#endpointsObject (readonly)

Returns the value of attribute endpoints.



4
5
6
# File 'lib/panda/routing/router.rb', line 4

def endpoints
  @endpoints
end

Instance Method Details

#draw(&block) ⇒ Object



10
11
12
# File 'lib/panda/routing/router.rb', line 10

def draw(&block)
  instance_eval(&block)
end

#root(target) ⇒ Object



20
# File 'lib/panda/routing/router.rb', line 20

def root(target) get "/", to: target end