Class: Async::Background::Web::App
- Inherits:
-
Object
- Object
- Async::Background::Web::App
- Defined in:
- lib/async/background/web/app.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #close ⇒ Object
-
#initialize(config) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(config) ⇒ App
Returns a new instance of App.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/async/background/web/app.rb', line 7 def initialize(config) @config = config.validate! @logger = @config.logger @auth = Auth.new(@config.auth, logger: @logger) @snapshot = Snapshot.new(path: @config.queue_path, counts_cache_ttl: @config.counts_cache_ttl).open! @metrics_reader = build_metrics_reader @serializer = Serializer.new(@config) @event_hub = build_event_hub @router = Router.new end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/async/background/web/app.rb', line 18 def call(env) head = env['REQUEST_METHOD'] == 'HEAD' response = handle(env, head: head) return response unless head status, headers, _body = response [status, headers, []] end |
#close ⇒ Object
27 28 29 30 31 |
# File 'lib/async/background/web/app.rb', line 27 def close @event_hub&.close @snapshot.close self end |