Class: SpeedtestNet::Result
- Inherits:
-
Object
- Object
- SpeedtestNet::Result
- Defined in:
- lib/speedtest_net/result.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #distance ⇒ Object
- #download ⇒ Object
-
#initialize(client, server, download_result, upload_result) ⇒ Result
constructor
A new instance of Result.
- #latency ⇒ Object
- #pretty_distance ⇒ Object
- #pretty_download ⇒ Object
- #pretty_latency ⇒ Object
- #pretty_upload ⇒ Object
- #upload ⇒ Object
Constructor Details
#initialize(client, server, download_result, upload_result) ⇒ Result
Returns a new instance of Result.
11 12 13 14 15 16 |
# File 'lib/speedtest_net/result.rb', line 11 def initialize(client, server, download_result, upload_result) @client = client @server = server @download_result = download_result @upload_result = upload_result end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/speedtest_net/result.rb', line 9 def client @client end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
9 10 11 |
# File 'lib/speedtest_net/result.rb', line 9 def server @server end |
Instance Method Details
#distance ⇒ Object
42 43 44 |
# File 'lib/speedtest_net/result.rb', line 42 def distance @server.distance end |
#download ⇒ Object
18 19 20 |
# File 'lib/speedtest_net/result.rb', line 18 def download @download_result.calculate end |
#latency ⇒ Object
34 35 36 |
# File 'lib/speedtest_net/result.rb', line 34 def latency @server.latency end |
#pretty_distance ⇒ Object
46 47 48 |
# File 'lib/speedtest_net/result.rb', line 46 def pretty_distance Formatter::Distance.call(distance) end |
#pretty_download ⇒ Object
22 23 24 |
# File 'lib/speedtest_net/result.rb', line 22 def pretty_download Formatter::Speed.call(download) end |
#pretty_latency ⇒ Object
38 39 40 |
# File 'lib/speedtest_net/result.rb', line 38 def pretty_latency Formatter::Latency.call(latency) end |
#pretty_upload ⇒ Object
30 31 32 |
# File 'lib/speedtest_net/result.rb', line 30 def pretty_upload Formatter::Speed.call(upload) end |
#upload ⇒ Object
26 27 28 |
# File 'lib/speedtest_net/result.rb', line 26 def upload @upload_result.calculate end |