module Roda::RodaPlugins::ParamsCapturing::RequestMethods
def _match_string(str)
Add the capture names from this string to list of param
def _match_string(str) if (pc = @_params_captures) && placeholder_string_matcher? pc.concat(str.scan(STRING_PARAM_CAPTURE_REGEXP)) end super end
def _match_string(str)
def _match_string(str) if (pc = @_params_captures) && placeholder_string_matcher? pc.concat(str.scan(/:\w+/).map{|s| s[STRING_PARAM_CAPTURE_RANGE]}) end super end
def _match_symbol(sym)
def _match_symbol(sym) if pc = @_params_captures pc << sym.to_s end super end
def if_match(args)
any captures to the params based on the param capture names added by
the matching, but turn it back off before yielding to the block. Add
If all arguments are strings or symbols, turn on param capturing during
def if_match(args) params = self.params if args.all?{|x| x.is_a?(String) || x.is_a?(Symbol)} pc = @_params_captures = [] end super do |*a| if pc @_params_captures = nil pc.zip(a).each do |k,v| params[k] = v end end params['captures'].concat(a) yield(*a) end end
def initialize(*)
def initialize(*) super params['captures'] = [] end