Sha256: 8addf49a0b6b31317f8d092e51b23c27cc6f1626e03442adea8b43b45b8ec2b6

Contents?: true

Size: 444 Bytes

Versions: 3

Compression:

Stored size: 444 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Web
    module Middleware
      #
      # DB connection adapter for Rack app
      #
      class ConnectionAdapter
        def initialize(app)
          @app = app
        end

        def call(env)
          Mihari::Database.with_db_connection do
            status, headers, body = @app.call(env)

            [status, headers, body]
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mihari-5.7.2 lib/mihari/web/middleware/connection_adapter.rb
mihari-5.7.1 lib/mihari/web/middleware/connection_adapter.rb
mihari-5.7.0 lib/mihari/web/middleware/connection_adapter.rb