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)
Instance Attribute Summary collapse
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
21 22 23 24 25 26 27 |
# File 'lib/proxy_fetcher/configuration.rb', line 21 def initialize @open_timeout = 3 @read_timeout = 3 @http_client = HTTPClient self.provider = :hide_my_name # currently default one end |
Instance Attribute Details
#http_client ⇒ Object
Returns the value of attribute http_client.
7 8 9 |
# File 'lib/proxy_fetcher/configuration.rb', line 7 def http_client @http_client end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
6 7 8 |
# File 'lib/proxy_fetcher/configuration.rb', line 6 def open_timeout @open_timeout end |
#provider ⇒ Object
Returns the value of attribute provider.
6 7 8 |
# File 'lib/proxy_fetcher/configuration.rb', line 6 def provider @provider end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
6 7 8 |
# File 'lib/proxy_fetcher/configuration.rb', line 6 def read_timeout @read_timeout end |
Class Method Details
.providers ⇒ Object
10 11 12 |
# File 'lib/proxy_fetcher/configuration.rb', line 10 def providers @providers ||= {} end |
.register_provider(name, klass) ⇒ Object
14 15 16 17 18 |
# File 'lib/proxy_fetcher/configuration.rb', line 14 def register_provider(name, klass) raise RegisteredProvider, "#{name} provider already registered!" if providers.key?(name.to_sym) providers[name.to_sym] = klass end |