Module: Instana::RodaPathTemplateExtractor::RequestMethods
- Defined in:
- lib/instana/frameworks/roda.rb
Constant Summary collapse
- TERM =
defined?(::Roda) ? ::Roda::RodaPlugins::Base::RequestMethods::TERM : Object
Instance Method Summary collapse
Instance Method Details
#if_match(args, &blk) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/instana/frameworks/roda.rb', line 11 def if_match(args, &blk) path = @remaining_path captures = @captures.clear if match_all(args) (env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] ||= []).concat(named_args(args, blk)) block_result(blk.(*captures)) env['INSTANA_HTTP_PATH_TEMPLATE'] = env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] .join('/') .prepend('/') throw :halt, response.finish else @remaining_path = path false end end |
#named_args(args, blk) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/instana/frameworks/roda.rb', line 28 def named_args(args, blk) parameters = blk.parameters args.map do |a| case a when String a when TERM nil else _, name = parameters.pop "{#{name}}" end end.reject { |v| v.nil? } end |