Class: RabbitMQHttpAuthBackend::App
- Inherits:
-
Object
- Object
- RabbitMQHttpAuthBackend::App
- Defined in:
- lib/rabbitmq_http_auth_backend/app.rb,
lib/rabbitmq_http_auth_backend/app/response_formatter.rb
Defined Under Namespace
Classes: ResponseFormatter
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(config) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(config) ⇒ App
Returns a new instance of App.
10 11 12 |
# File 'lib/rabbitmq_http_auth_backend/app.rb', line 10 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/rabbitmq_http_auth_backend/app.rb', line 8 def config @config end |
Instance Method Details
#generate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rabbitmq_http_auth_backend/app.rb', line 14 def generate # NOTE: config has to be bound to the local scope as a variable to be # accessible from within the class that is being built config = self.config Class.new(Roda) do route do |r| RESOURCES.map do |resource| r.on(config.fetch(resource, :path)) do r.is do r.public_send(config.http_method) do result = RabbitMQHttpAuthBackend::Resolver .call(r.params, config.fetch(resource, :resolver)) ResponseFormatter.call(result) end end end end.last end end.freeze.app end |