Module: Mutx::MonkeyPatch
- Included in:
- App
- Defined in:
- lib/mutx/lib/monkey_patch.rb
Instance Method Summary collapse
Instance Method Details
#on(*args, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mutx/lib/monkey_patch.rb', line 7 def on(*args, &block) try do @captures = [] return unless args.all? { |arg| match(arg) } captures.map! {|capture| URI.unescape(capture) } yield(*captures) if res.status.nil? if res.body.empty? not_found else res.headers[Rack::CONTENT_TYPE] ||= Cuba::DEFAULT res.status = 200 end end halt(res.finish) end end |