Sha256: 2c172d954372c830945ebdf07548eaeaf7e31f98fd0dadbe9a5986909cbd0b5f

Contents?: true

Size: 1.33 KB

Versions: 24

Compression:

Stored size: 1.33 KB

Contents

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

    def initialize(options = {}, &block)
      @pool = options.fetch(:pool) { ::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

24 entries across 24 versions & 2 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/connection_pool-2.2.5/lib/connection_pool/wrapper.rb