Class: Sinatra::SwaggerExposer::Processing::SwaggerFileProcessorDispatcher
- Inherits:
-
Object
- Object
- Sinatra::SwaggerExposer::Processing::SwaggerFileProcessorDispatcher
- Defined in:
- lib/sinatra/swagger-exposer/processing/swagger-file-processor-dispatcher.rb
Overview
Fake dispatcher for files
Instance Method Summary collapse
-
#initialize(name, required) ⇒ SwaggerFileProcessorDispatcher
constructor
Initialize.
-
#process(app, parsed_body) ⇒ Object
Process the value.
- #useful? ⇒ Boolean
Constructor Details
#initialize(name, required) ⇒ SwaggerFileProcessorDispatcher
Initialize
15 16 17 18 |
# File 'lib/sinatra/swagger-exposer/processing/swagger-file-processor-dispatcher.rb', line 15 def initialize(name, required) @name = name @required = required end |
Instance Method Details
#process(app, parsed_body) ⇒ Object
Process the value
25 26 27 28 29 30 |
# File 'lib/sinatra/swagger-exposer/processing/swagger-file-processor-dispatcher.rb', line 25 def process(app, parsed_body) if app.params.key?(@name.to_s) && (!app.params[@name.to_s].nil?) elsif @required raise SwaggerInvalidException.new("Mandatory value [#{@name}] is missing") end end |
#useful? ⇒ Boolean
20 21 22 |
# File 'lib/sinatra/swagger-exposer/processing/swagger-file-processor-dispatcher.rb', line 20 def useful? @required end |