Sha256: 3b09b08acf45afa71f4a3abeff031555317a87ad2183c460c2920434235343bf

Contents?: true

Size: 597 Bytes

Versions: 141

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

require 'monitor'

module Faraday
  # AdapterRegistry registers adapter class names so they can be looked up by a
  # String or Symbol name.
  class AdapterRegistry
    def initialize
      @lock = Monitor.new
      @constants = {}
    end

    def get(name)
      klass = @lock.synchronize do
        @constants[name]
      end
      return klass if klass

      Object.const_get(name).tap { |c| set(c, name) }
    end

    def set(klass, name = nil)
      name ||= klass.to_s
      @lock.synchronize do
        @constants[name] = klass
      end
    end
  end
end

Version data entries

141 entries across 128 versions & 20 rubygems

Version Path
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/lib/faraday/adapter_registry.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/lib/faraday/adapter_registry.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/lib/faraday/adapter_registry.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/lib/faraday/adapter_registry.rb
faraday-1.1.0 lib/faraday/adapter_registry.rb
passbase-1.0.2 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
passbase-1.0.1 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
passbase-1.0.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/lib/faraday/adapter_registry.rb