Class: Messaging::Middleware::RailsWrapper
- Inherits:
-
Object
- Object
- Messaging::Middleware::RailsWrapper
- Defined in:
- lib/messaging/middleware/rails_wrapper.rb
Overview
Used for hot code reloading (in development) and connection handling. This makes Rails automatically return AR connections to the pool after we have used them when processing a messages.
See guides.rubyonrails.org/threading_and_code_execution.html for more information.
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Instance Method Summary collapse
- #call(*_args) ⇒ Object
-
#initialize(app) ⇒ RailsWrapper
constructor
A new instance of RailsWrapper.
Constructor Details
#initialize(app) ⇒ RailsWrapper
Returns a new instance of RailsWrapper.
11 12 13 |
# File 'lib/messaging/middleware/rails_wrapper.rb', line 11 def initialize(app) self.app = app end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
9 10 11 |
# File 'lib/messaging/middleware/rails_wrapper.rb', line 9 def app @app end |
Instance Method Details
#call(*_args) ⇒ Object
15 16 17 18 19 |
# File 'lib/messaging/middleware/rails_wrapper.rb', line 15 def call(*_args) app.reloader.wrap do yield end end |