Module: Roda::RodaPlugins::ClassMatchers::ClassMethods
- Defined in:
- lib/roda/plugins/class_matchers.rb
Instance Method Summary collapse
-
#class_matcher(klass, re, &block) ⇒ Object
Set the regexp to use for the given class.
Instance Method Details
#class_matcher(klass, re, &block) ⇒ Object
Set the regexp to use for the given class. The block given will be called with all matched values from the regexp, and should return an array with the captures to yield to the match block.
50 51 52 53 54 55 56 57 |
# File 'lib/roda/plugins/class_matchers.rb', line 50 def class_matcher(klass, re, &block) meth = :"_match_class_#{klass}" self::RodaRequest.class_eval do consume_re = consume_pattern(re) define_method(meth){consume(consume_re, &block)} private meth end end |