Class: GarageClient::Response::Cacheable

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/garage_client/response/cacheable.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, args) ⇒ Cacheable

Returns a new instance of Cacheable.



6
7
8
9
10
# File 'lib/garage_client/response/cacheable.rb', line 6

def initialize(app, args)
  super(app)
  @cacher_class = args[:cacher]
  validate!
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
# File 'lib/garage_client/response/cacheable.rb', line 12

def call(env)
  @cacher_class.new(env).call { @app.call(env) }
end