Class: MtrMonitor::Hop
- Inherits:
-
Object
- Object
- MtrMonitor::Hop
- Defined in:
- lib/mtr_monitor/hop.rb
Overview
represents one hop in the MTR report
example hop for ‘mtr –report github.com`: 12.|– github-ic-318125-ash-b1.c 0.0% 10 136.2 136.2 135.0 140.7 1.5
Instance Attribute Summary collapse
-
#avg ⇒ Object
readonly
Returns the value of attribute avg.
-
#best ⇒ Object
readonly
Returns the value of attribute best.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#loss ⇒ Object
readonly
Returns the value of attribute loss.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#snt ⇒ Object
readonly
Returns the value of attribute snt.
-
#std_dev ⇒ Object
readonly
Returns the value of attribute std_dev.
-
#worst ⇒ Object
readonly
Returns the value of attribute worst.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, loss, snt, last, avg, best, worst, std_dev) ⇒ Hop
constructor
A new instance of Hop.
Constructor Details
#initialize(name, loss, snt, last, avg, best, worst, std_dev) ⇒ Hop
Returns a new instance of Hop.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mtr_monitor/hop.rb', line 17 def initialize(name, loss, snt, last, avg, best, worst, std_dev) @name = name @loss = loss.to_f @snt = snt.to_i @last = last.to_f @avg = avg.to_f @best = best.to_f @worst = worst.to_f @std_dev = std_dev.to_f end |
Instance Attribute Details
#avg ⇒ Object (readonly)
Returns the value of attribute avg.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def avg @avg end |
#best ⇒ Object (readonly)
Returns the value of attribute best.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def best @best end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def last @last end |
#loss ⇒ Object (readonly)
Returns the value of attribute loss.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def loss @loss end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def name @name end |
#snt ⇒ Object (readonly)
Returns the value of attribute snt.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def snt @snt end |
#std_dev ⇒ Object (readonly)
Returns the value of attribute std_dev.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def std_dev @std_dev end |
#worst ⇒ Object (readonly)
Returns the value of attribute worst.
15 16 17 |
# File 'lib/mtr_monitor/hop.rb', line 15 def worst @worst end |
Class Method Details
.parse(line) ⇒ Object
9 10 11 12 13 |
# File 'lib/mtr_monitor/hop.rb', line 9 def self.parse(line) return unless line =~ /\|--/ new(*line.split(" ")[1..-1]) end |