Class: ProxyFetcher::Configuration
- Inherits:
-
Object
- Object
- ProxyFetcher::Configuration
- Defined in:
- lib/proxy_fetcher/configuration.rb
Constant Summary collapse
- UnknownProvider =
Class.new(StandardError)
- ProviderRegistered =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#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.
20 21 22 23 24 25 |
# File 'lib/proxy_fetcher/configuration.rb', line 20 def initialize @open_timeout = 3 @read_timeout = 3 self.provider = :hide_my_name # currently default one end |
Instance Attribute Details
#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
9 10 11 |
# File 'lib/proxy_fetcher/configuration.rb', line 9 def providers @providers ||= {} end |
.register_provider(name, klass) ⇒ Object
13 14 15 16 17 |
# File 'lib/proxy_fetcher/configuration.rb', line 13 def register_provider(name, klass) raise ProviderRegistered, "#{name} provider already registered!" if providers.key?(name.to_sym) providers[name.to_sym] = klass end |