Class: Croods::Middleware::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/croods/middleware/base.rb

Direct Known Subclasses

RequestValidation, ResponseValidation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, **options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/croods/middleware/base.rb', line 8

def initialize(app, **options)
  self.app = app
  self.options = options
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



6
7
8
# File 'lib/croods/middleware/base.rb', line 6

def app
  @app
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/croods/middleware/base.rb', line 6

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
# File 'lib/croods/middleware/base.rb', line 13

def call(env)
  committee = self.class.name.gsub('Croods', 'Committee').constantize
    .new(app, options.merge(schema: Croods.json_schema))
  committee.call(env)
end