Class: Capybara::RegistrationContainer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/registration_container.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, **options, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


19
20
21
22
23
24
25
26
27
28
# File 'lib/capybara/registration_container.rb', line 19

def method_missing(method_name, *args, **options, &block)
  if @registered.respond_to?(method_name)
    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

Instance Method Details

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


10
11
12
# File 'lib/capybara/registration_container.rb', line 10

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

#[]=(name, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
17
# File 'lib/capybara/registration_container.rb', line 14

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

#namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


6
7
8
# File 'lib/capybara/registration_container.rb', line 6

def names
  @registered.keys
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

30
31
32
# File 'lib/capybara/registration_container.rb', line 30

def respond_to_missing?(method_name, include_private = false)
  @registered.respond_to?(method_name) || super
end