Module: ActionDispatch::Journey::Route::VerbMatchers
- Defined in:
- actionpack/lib/action_dispatch/journey/route.rb
Defined Under Namespace
Classes: All, Or, Unknown
Constant Summary
collapse
- VERBS =
%w{ DELETE GET HEAD OPTIONS LINK PATCH POST PUT TRACE UNLINK }
- VERB_TO_CLASS =
VERBS.each_with_object(all: All) do |verb, hash|
klass = const_get verb
hash[verb] = klass
hash[verb.downcase] = klass
hash[verb.downcase.to_sym] = klass
end
Class Method Summary
collapse
Class Method Details
.for(verbs) ⇒ Object
65
66
67
68
69
70
71
72
73
|
# File 'actionpack/lib/action_dispatch/journey/route.rb', line 65
def self.for(verbs)
if verbs.any? { |v| VERB_TO_CLASS[v] == All }
All
elsif verbs.one?
VERB_TO_CLASS[verbs.first]
else
Or.new(verbs.map { |v| VERB_TO_CLASS[v] })
end
end
|