Class: NATS::Rails::Reloader
- Inherits:
-
Object
- Object
- NATS::Rails::Reloader
- Defined in:
- lib/nats/io/rails.rb
Overview
This class is used to free resources managed by Rails (e.g. database connections) that were implicitly acquired in subscription callbacks Implementation is based on github.com/sidekiq/sidekiq/blob/5e1a77a6d03193dd977fbfe8961ab78df91bb392/lib/sidekiq/rails.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(app = ::Rails.application) ⇒ Reloader
constructor
A new instance of Reloader.
- #inspect ⇒ Object
Constructor Details
#initialize(app = ::Rails.application) ⇒ Reloader
Returns a new instance of Reloader.
9 10 11 |
# File 'lib/nats/io/rails.rb', line 9 def initialize(app = ::Rails.application) @app = app end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 |
# File 'lib/nats/io/rails.rb', line 13 def call params = (::Rails::VERSION::STRING >= "7.1") ? {source: "gem.nats"} : {} @app.reloader.wrap(**params) do yield end end |
#inspect ⇒ Object
20 21 22 |
# File 'lib/nats/io/rails.rb', line 20 def inspect "#<NATS::Rails::Reloader @app=#{@app.class.name}>" end |