Sha256: d7322619fe93fb3e8977e749b67e048b6eaae615968c8bcb41c9862095bfd088

Contents?: true

Size: 1.17 KB

Versions: 25

Compression:

Stored size: 1.17 KB

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"
        # RUBY 2.6 will send an empty hash rather than nothing with **options so fix that
        return @registered.public_send(method_name, *args, &block) if options.empty?

        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

25 entries across 15 versions & 3 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/registration_container.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/registration_container.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/capybara-3.36.0/lib/capybara/registration_container.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/registration_container.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/registration_container.rb
capybara-3.36.0 lib/capybara/registration_container.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/registration_container.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/registration_container.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/registration_container.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/registration_container.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/registration_container.rb
capybara-3.35.3 lib/capybara/registration_container.rb