Class: Jeanine::Router

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/jeanine/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouter

Returns a new instance of Router.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jeanine/router.rb', line 10

def initialize
  @routes = {
      GET: [],
      POST: [],
      PATCH: [],
      PUT: [],
      DELETE: [],
      OPTIONS: [],
      HEAD: [],
  }
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



9
10
11
# File 'lib/jeanine/router.rb', line 9

def routes
  @routes
end

Instance Method Details

#add(verb, path, options = {}, &block) ⇒ Object



22
23
24
# File 'lib/jeanine/router.rb', line 22

def add(verb, path, options = {}, &block)
  routes[verb] << build_route("#{path}", options, &block)
end