Class: ProxyFetcher::Configuration
- Inherits:
-
Object
- Object
- ProxyFetcher::Configuration
- Defined in:
- lib/proxy_fetcher/configuration.rb
Constant Summary collapse
- DEFAULT_USER_AGENT =
rubocop:disable Metrics/LineLength
'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112 Safari/537.36'.freeze
Instance Attribute Summary collapse
-
#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.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
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.
23 24 25 |
# File 'lib/proxy_fetcher/configuration.rb', line 23 def initialize reset! end |
Instance Attribute Details
#http_client ⇒ Object
Returns the value of attribute http_client.
4 5 6 |
# File 'lib/proxy_fetcher/configuration.rb', line 4 def http_client @http_client end |
#pool_size ⇒ Object
Returns the value of attribute pool_size.
3 4 5 |
# File 'lib/proxy_fetcher/configuration.rb', line 3 def pool_size @pool_size end |
#providers ⇒ Object Also known as: provider
Returns the value of attribute providers.
3 4 5 |
# File 'lib/proxy_fetcher/configuration.rb', line 3 def providers @providers end |
#proxy_validator ⇒ Object
Returns the value of attribute proxy_validator.
4 5 6 |
# File 'lib/proxy_fetcher/configuration.rb', line 4 def proxy_validator @proxy_validator end |
#timeout ⇒ Object
Returns the value of attribute timeout.
3 4 5 |
# File 'lib/proxy_fetcher/configuration.rb', line 3 def timeout @timeout end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
3 4 5 |
# File 'lib/proxy_fetcher/configuration.rb', line 3 def user_agent @user_agent end |
Class Method Details
.providers_registry ⇒ Object
10 11 12 |
# File 'lib/proxy_fetcher/configuration.rb', line 10 def providers_registry @registry ||= ProvidersRegistry.new end |
.register_provider(name, klass) ⇒ Object
14 15 16 |
# File 'lib/proxy_fetcher/configuration.rb', line 14 def register_provider(name, klass) providers_registry.register(name, klass) end |
.registered_providers ⇒ Object
18 19 20 |
# File 'lib/proxy_fetcher/configuration.rb', line 18 def registered_providers providers_registry.providers.keys end |
Instance Method Details
#reset! ⇒ Object
Sets default configuration options
28 29 30 31 32 33 34 35 36 |
# File 'lib/proxy_fetcher/configuration.rb', line 28 def reset! @user_agent = DEFAULT_USER_AGENT @pool_size = 10 @timeout = 3 @http_client = HTTPClient @proxy_validator = ProxyValidator self.providers = self.class.registered_providers end |