Class: ProxyFetcher::Configuration
- Inherits:
-
Object
- Object
- ProxyFetcher::Configuration
- Defined in:
- lib/proxy_fetcher/configuration.rb
Constant Summary collapse
- WrongCustomClass =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#connection_timeout ⇒ Object
Returns the value of attribute connection_timeout.
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#pool_size ⇒ Object
Returns the value of attribute pool_size.
-
#providers ⇒ Object
(also: #provider)
Returns the value of attribute providers.
-
#proxy_validator ⇒ Object
Returns the value of attribute proxy_validator.
Class Method Summary collapse
- .providers_registry ⇒ Object
- .register_provider(name, klass) ⇒ Object
- .registered_providers ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ Object
Sets default configuration options.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 |
# File 'lib/proxy_fetcher/configuration.rb', line 22 def initialize reset! end |
Instance Attribute Details
#connection_timeout ⇒ Object
Returns the value of attribute connection_timeout.
5 6 7 |
# File 'lib/proxy_fetcher/configuration.rb', line 5 def connection_timeout @connection_timeout end |
#http_client ⇒ Object
Returns the value of attribute http_client.
6 7 8 |
# File 'lib/proxy_fetcher/configuration.rb', line 6 def http_client @http_client end |
#pool_size ⇒ Object
Returns the value of attribute pool_size.
5 6 7 |
# File 'lib/proxy_fetcher/configuration.rb', line 5 def pool_size @pool_size end |
#providers ⇒ Object Also known as: provider
Returns the value of attribute providers.
5 6 7 |
# File 'lib/proxy_fetcher/configuration.rb', line 5 def providers @providers end |
#proxy_validator ⇒ Object
Returns the value of attribute proxy_validator.
6 7 8 |
# File 'lib/proxy_fetcher/configuration.rb', line 6 def proxy_validator @proxy_validator end |
Class Method Details
.providers_registry ⇒ Object
9 10 11 |
# File 'lib/proxy_fetcher/configuration.rb', line 9 def providers_registry @registry ||= ProvidersRegistry.new end |
.register_provider(name, klass) ⇒ Object
13 14 15 |
# File 'lib/proxy_fetcher/configuration.rb', line 13 def register_provider(name, klass) providers_registry.register(name, klass) end |
.registered_providers ⇒ Object
17 18 19 |
# File 'lib/proxy_fetcher/configuration.rb', line 17 def registered_providers providers_registry.providers.keys end |
Instance Method Details
#reset! ⇒ Object
Sets default configuration options
27 28 29 30 31 32 33 34 |
# File 'lib/proxy_fetcher/configuration.rb', line 27 def reset! @pool_size = 10 @connection_timeout = 3 @http_client = HTTPClient @proxy_validator = ProxyValidator self.providers = self.class.registered_providers end |