module Roda::RodaPlugins::ParamMatchers::RequestMethods

  1. lib/roda/plugins/param_matchers.rb

Public Instance methods

match_param(key)

Match the given parameter if present, even if the parameter is empty. Adds match to the captures.

[show source]
   # File lib/roda/plugins/param_matchers.rb
49 def match_param(key)
50   if v = params[key.to_s]
51     @captures << v
52   end
53 end
match_param!(key)

Match the given parameter if present and not empty. Adds match to the captures.

[show source]
   # File lib/roda/plugins/param_matchers.rb
57 def match_param!(key)
58   if (v = params[key.to_s]) && !v.empty?
59     @captures << v
60   end
61 end
match_params(keys)

Match all given parameters if present, even if any/all parameters is empty. Adds all matches to the captures.

[show source]
   # File lib/roda/plugins/param_matchers.rb
65 def match_params(keys)
66   keys.each do |key|
67     return false unless match_param(key)
68   end
69 end
match_params!(keys)

Match all given parameters if present and not empty. Adds all matches to the captures.

[show source]
   # File lib/roda/plugins/param_matchers.rb
73 def match_params!(keys)
74   keys.each do |key|
75     return false unless match_param!(key)
76   end
77 end