Module: Roda::RodaPlugins::HashMatcher::ClassMethods
- Defined in:
- lib/roda/plugins/hash_matcher.rb
Instance Method Summary collapse
-
#hash_matcher(key, &block) ⇒ Object
Create a match_#key method in the request class using the given block, so that using a hash key in a request match method will call the block.
Instance Method Details
#hash_matcher(key, &block) ⇒ Object
Create a match_#key method in the request class using the given block, so that using a hash key in a request match method will call the block. The block should return nil or false to not match, and anything else to match. See the HashMatcher module documentation for an example.
27 28 29 |
# File 'lib/roda/plugins/hash_matcher.rb', line 27 def hash_matcher(key, &block) self::RodaRequest.send(:define_method, :"match_#{key}", &block) end |