Module: MailGrabber::Web::ApplicationRouter
- Included in:
- Application
- Defined in:
- lib/mail_grabber/web/application_router.rb
Defined Under Namespace
Classes: Route
Constant Summary collapse
- NAMED_SEGMENTS_PATTERN =
%r{/([^/]*):([^.:$/]+)}.freeze
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
-
#route(method, pattern, &block) ⇒ Object
Store routes with the request method, the provided pattern and the given block.
-
#set_route(method, pattern, &block) ⇒ Object
Set routes Hash with the Route object.
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
8 9 10 |
# File 'lib/mail_grabber/web/application_router.rb', line 8 def routes @routes end |
Instance Method Details
#route(method, pattern, &block) ⇒ Object
Store routes with the request method, the provided pattern and the given block.
62 63 64 65 66 67 |
# File 'lib/mail_grabber/web/application_router.rb', line 62 def route(method, pattern, &block) @routes ||= {} set_route('HEAD', pattern, &block) if method == 'GET' set_route(method, pattern, &block) end |
#set_route(method, pattern, &block) ⇒ Object
Set routes Hash with the Route object.
74 75 76 |
# File 'lib/mail_grabber/web/application_router.rb', line 74 def set_route(method, pattern, &block) (@routes[method] ||= []) << Route.new(pattern, block) end |