Sha256: b8a10e047501a447daf93e5bbfb0eb287333850e9b5587d4215e447b44459fe9

Contents?: true

Size: 727 Bytes

Versions: 36

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Faraday
  # Middleware is the basic base class of any Faraday middleware.
  class Middleware
    extend MiddlewareRegistry

    attr_reader :app, :options

    def initialize(app = nil, options = {})
      @app = app
      @options = options
    end

    def call(env)
      on_request(env) if respond_to?(:on_request)
      app.call(env).on_complete do |environment|
        on_complete(environment) if respond_to?(:on_complete)
      end
    rescue StandardError => e
      on_error(e) if respond_to?(:on_error)
      raise
    end

    def close
      if app.respond_to?(:close)
        app.close
      else
        warn "#{app} does not implement \#close!"
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 4 rubygems

Version Path
moneykit-0.1.15 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.14 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.13 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.12 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.11 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
faraday-2.9.2 lib/faraday/middleware.rb
faraday-2.9.1 lib/faraday/middleware.rb
moneykit-0.1.10 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.9 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.6 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.5 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.4 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.3 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
faraday-2.9.0 lib/faraday/middleware.rb
faraday-2.8.1 lib/faraday/middleware.rb
moneykit-0.1.2 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
faraday-2.8.0 lib/faraday/middleware.rb
moneykit-0.1.1 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.0 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb
moneykit-0.1.0.alpha.2 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/lib/faraday/middleware.rb