module Roda::RodaPlugins::HashMatcher::ClassMethods

  1. lib/roda/plugins/hash_matcher.rb

Methods

Public Instance

  1. hash_matcher

Public Instance methods

hash_matcher(key, &block)

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.

[show source]
   # File lib/roda/plugins/hash_matcher.rb
27 def hash_matcher(key, &block)
28   meth = :"match_#{key}"
29   self::RodaRequest.send(:define_method, meth, &block)
30   self::RodaRequest.send(:private, meth)
31 end