module Roda::RodaPlugins::ClassMatchers::ClassMethods

  1. lib/roda/plugins/class_matchers.rb

Methods

Public Instance

  1. class_matcher

Public Instance methods

class_matcher(klass, re, &block)

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.

[show source]
   # File lib/roda/plugins/class_matchers.rb
50 def class_matcher(klass, re, &block)
51   meth = :"_match_class_#{klass}"
52   self::RodaRequest.class_eval do
53     consume_re = consume_pattern(re)
54     define_method(meth){consume(consume_re, &block)}
55     private meth
56   end
57 end