Public Instance methods
class_matcher(klass, matcher, opts=OPTS, &block)
Set the matcher and block to use for the given class. The matcher can be a regexp, registered class matcher, or registered symbol matcher (if using the symbol_matchers plugin).
If providing a regexp, the block given will be called with all regexp captures. If providing a registered class or symbol, the block will be called with the captures returned by the block for the registered class or symbol, or the regexp captures if no block was registered with the class or symbol. In either case, if a block is given, it should return an array with the captures to yield to the match block.
[show source]
# File lib/roda/plugins/class_matchers.rb 108 def class_matcher(klass, matcher, opts=OPTS, &block) 109 _symbol_class_matcher(Class, klass, matcher, block, opts) do |meth, (_, regexp, convert_meth, consume_meth)| 110 if regexp 111 if consume_meth == :_consume_single_segment 112 define_method(meth){_consume_single_segment(regexp, convert_meth)} 113 else 114 define_method(meth){consume(regexp, convert_meth)} 115 end 116 else 117 define_method(meth){_consume_segment(convert_meth)} 118 end 119 end 120 end
freeze()
Freeze the class_matchers hash when freezing the app.
[show source]
# File lib/roda/plugins/class_matchers.rb 123 def freeze 124 class_matchers.freeze 125 super 126 end