Class: ProxyFetcher::Configuration
- Inherits:
-
Object
- Object
- ProxyFetcher::Configuration
- Defined in:
- lib/proxy_fetcher/configuration.rb
Constant Summary collapse
- UnknownProvider =
Class.new(StandardError)
- RegisteredProvider =
Class.new(StandardError)
- 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.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#proxy_validator ⇒ Object
Returns the value of attribute proxy_validator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset! ⇒ Object
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.
7 8 9 |
# File 'lib/proxy_fetcher/configuration.rb', line 7 def connection_timeout @connection_timeout end |
#http_client ⇒ Object
Returns the value of attribute http_client.
8 9 10 |
# File 'lib/proxy_fetcher/configuration.rb', line 8 def http_client @http_client end |
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/proxy_fetcher/configuration.rb', line 8 def logger @logger end |
#provider ⇒ Object
Returns the value of attribute provider.
7 8 9 |
# File 'lib/proxy_fetcher/configuration.rb', line 7 def provider @provider end |
#proxy_validator ⇒ Object
Returns the value of attribute proxy_validator.
8 9 10 |
# File 'lib/proxy_fetcher/configuration.rb', line 8 def proxy_validator @proxy_validator end |
Class Method Details
.providers ⇒ Object
11 12 13 |
# File 'lib/proxy_fetcher/configuration.rb', line 11 def providers @providers ||= {} end |
.register_provider(name, klass) ⇒ Object
15 16 17 18 19 |
# File 'lib/proxy_fetcher/configuration.rb', line 15 def register_provider(name, klass) raise RegisteredProvider, "`#{name}` provider already registered!" if providers.key?(name.to_sym) providers[name.to_sym] = klass end |
Instance Method Details
#reset! ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/proxy_fetcher/configuration.rb', line 26 def reset! @connection_timeout = 3 @http_client = HTTPClient @proxy_validator = ProxyValidator self.provider = :hide_my_name # currently default one end |