Module: Sinatra::Bind::ClassMethods
- Defined in:
- lib/sinatra/bind.rb
Constant Summary collapse
- FILTER_NAMES =
['BEFORE', 'AFTER'].freeze
Instance Method Summary collapse
-
#on(path, options = {}) ⇒ Object
Defines a route without block smoothly.
Instance Method Details
#on(path, options = {}) ⇒ Object
Defines a route without block smoothly
42 43 44 45 46 47 48 49 50 |
# File 'lib/sinatra/bind.rb', line 42 def on(path, = {}) verb = (.delete(:type) || 'GET').to_s.upcase return bound_filter(verb, path, ) if FILTER_NAMES.include?(verb) method_name = .delete(:to) process_bound_route(verb, path, method_name) do method = instance_method(method_name) bound_route(verb, path, .merge(method_name: "#{verb} #{method_name}"), method) end end |