Sha256: d2b84bc7b2a6688740d881e87e178892c7aaa0f507b12e74f5c9faa507ad910c

Contents?: true

Size: 1.35 KB

Versions: 69

Compression:

Stored size: 1.35 KB

Contents

class Bundler::ConnectionPool
  class Wrapper < ::BasicObject
    METHODS = [:with, :pool_shutdown, :wrapped_pool]

    def initialize(options = {}, &block)
      @pool = options.fetch(:pool) { ::Bundler::ConnectionPool.new(options, &block) }
    end

    def wrapped_pool
      @pool
    end

    def with(&block)
      @pool.with(&block)
    end

    def pool_shutdown(&block)
      @pool.shutdown(&block)
    end

    def pool_size
      @pool.size
    end

    def pool_available
      @pool.available
    end

    def respond_to?(id, *args)
      METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
    end

    # rubocop:disable Style/MethodMissingSuper
    # rubocop:disable Style/MissingRespondToMissing
    if ::RUBY_VERSION >= "3.0.0"
      def method_missing(name, *args, **kwargs, &block)
        with do |connection|
          connection.send(name, *args, **kwargs, &block)
        end
      end
    elsif ::RUBY_VERSION >= "2.7.0"
      ruby2_keywords def method_missing(name, *args, &block)
        with do |connection|
          connection.send(name, *args, &block)
        end
      end
    else
      def method_missing(name, *args, &block)
        with do |connection|
          connection.send(name, *args, &block)
        end
      end
    end
    # rubocop:enable Style/MethodMissingSuper
    # rubocop:enable Style/MissingRespondToMissing
  end
end

Version data entries

69 entries across 69 versions & 4 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/bundler-2.3.5/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.27 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.27 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/bundler-2.3.5/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.2.34 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.2.34 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/bundler-2.3.7/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.26 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.26 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.25 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.25 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.24 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.24 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.23 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.23 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.22 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.22 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.21 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
bundler-2.3.21 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
rubygems-update-3.3.20 bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb