Class: URLReader
- Inherits:
-
Object
- Object
- URLReader
- Defined in:
- lib/read_url.rb
Instance Attribute Summary collapse
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
-
#initialize ⇒ URLReader
constructor
A new instance of URLReader.
- #read(url) ⇒ Object
Constructor Details
#initialize ⇒ URLReader
8 9 10 |
# File 'lib/read_url.rb', line 8 def initialize $temperature end |
Instance Attribute Details
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
6 7 8 |
# File 'lib/read_url.rb', line 6 def temperature @temperature end |
Instance Method Details
#read(url) ⇒ Object
12 13 14 |
# File 'lib/read_url.rb', line 12 def read url $temperature = Net::HTTP.get(URI.parse(url)).to_f end |