Sha256: 342c61bdf898a62550fd94ae5b5c891f918e9194efaf2ac2ed5184415f7a8f14

Contents?: true

Size: 1018 Bytes

Versions: 8

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

module Capybara
  # @api private
  class RegistrationContainer
    def names
      @registered.keys
    end

    def [](name)
      @registered[name]
    end

    def []=(name, value)
      Capybara::Helpers.warn 'DEPRECATED: Directly setting drivers/servers is deprecated, please use Capybara.register_driver/register_server instead'
      @registered[name] = value
    end

    def method_missing(method_name, *args, **options, &block)
      if @registered.respond_to?(method_name)
        Capybara::Helpers.warn "DEPRECATED: Calling '#{method_name}' on the drivers/servers container is deprecated without replacement"
        return @registered.public_send(method_name, *args, **options, &block)
      end
      super
    end

    def respond_to_missing?(method_name, include_all)
      @registered.respond_to?(method_name) || super
    end

  private

    def initialize
      @registered = {}
    end

    def register(name, block)
      @registered[name] = block
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
capybara-3.39.2 lib/capybara/registration_container.rb
capybara-3.39.1 lib/capybara/registration_container.rb
capybara-3.39.0 lib/capybara/registration_container.rb
capybara-3.38.0 lib/capybara/registration_container.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/registration_container.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/registration_container.rb
capybara-3.37.1 lib/capybara/registration_container.rb
capybara-3.37.0 lib/capybara/registration_container.rb