Class: Jeanine::Router
- Inherits:
-
Object
- Object
- Jeanine::Router
- Extended by:
- Forwardable
- Defined in:
- lib/jeanine/router.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #add(verb, path, options = {}, &block) ⇒ Object
-
#initialize ⇒ Router
constructor
A new instance of Router.
Constructor Details
#initialize ⇒ Router
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
#routes ⇒ Object (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, = {}, &block) routes[verb] << build_route("#{path}", , &block) end |