Module: Roda::RodaPlugins::CustomMatchers::ClassMethods

Defined in:
lib/roda/plugins/custom_matchers.rb

Instance Method Summary collapse

Instance Method Details

#custom_matcher(match_class, &block) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/roda/plugins/custom_matchers.rb', line 61

def custom_matcher(match_class, &block)
  custom_matchers = Hash[opts[:custom_matchers]]
  meth = custom_matchers[match_class] = custom_matchers[match_class] || :"_custom_matcher_#{match_class}"
  opts[:custom_matchers] = custom_matchers.freeze
  self::RodaRequest.send(:define_method, meth, &block)
  nil
end