Class: RatPackSwagger::RequestValidatorCollection
- Inherits:
-
Object
- Object
- RatPackSwagger::RequestValidatorCollection
- Defined in:
- lib/request_validators.rb
Instance Method Summary collapse
- #get(path, verb, type = nil) ⇒ Object
-
#initialize ⇒ RequestValidatorCollection
constructor
A new instance of RequestValidatorCollection.
- #set(path, verb, type, validator) ⇒ Object
Constructor Details
#initialize ⇒ RequestValidatorCollection
Returns a new instance of RequestValidatorCollection.
6 7 8 |
# File 'lib/request_validators.rb', line 6 def initialize @validators = {} end |
Instance Method Details
#get(path, verb, type = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/request_validators.rb', line 10 def get(path, verb, type = nil) if @validators[path] if @validators[path][verb] if type if @validators[path][verb][type] return @validators[path][verb][type] end else return @validators[path][verb] end end end return nil end |
#set(path, verb, type, validator) ⇒ Object
25 26 27 28 29 |
# File 'lib/request_validators.rb', line 25 def set(path, verb, type, validator) @validators[path] ||= {} @validators[path][verb] ||= {} @validators[path][verb][type] = validator end |