Class: UniParser::Proxy
- Inherits:
-
Object
- Object
- UniParser::Proxy
- Defined in:
- lib/uni_parser/proxy.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #freeze ⇒ Object
- #freeze_time ⇒ Object
- #frozen? ⇒ Boolean
-
#initialize(url) ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
#initialize(url) ⇒ Proxy
Returns a new instance of Proxy.
5 6 7 8 |
# File 'lib/uni_parser/proxy.rb', line 5 def initialize(url) uri = URI url @host, @port = uri.host, uri.port end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/uni_parser/proxy.rb', line 3 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
3 4 5 |
# File 'lib/uni_parser/proxy.rb', line 3 def port @port end |
Instance Method Details
#freeze ⇒ Object
10 11 12 |
# File 'lib/uni_parser/proxy.rb', line 10 def freeze @frozen_to = Time.now + freeze_time end |
#freeze_time ⇒ Object
14 15 16 |
# File 'lib/uni_parser/proxy.rb', line 14 def freeze_time UniParser.config.proxy_freeze_time || 1.minute end |
#frozen? ⇒ Boolean
18 19 20 |
# File 'lib/uni_parser/proxy.rb', line 18 def frozen? Time.now < @frozen_to end |