class Vnstat::Traffic::Tops
A class representing a collection of tracked tops.
Public Instance Methods
[](index)
click to toggle source
Fetches a single {Result::Minute} from the collection.
@param [Integer] index The index of the entry in the collection. @return [Result::Minute]
# File lib/vnstat/traffic/tops.rb, line 27 def [](index) to_a[index] end
each(&block)
click to toggle source
Iterates over all results in the collection.
@overload each
@return [Enumerator]
@overload each(&block)
@yield [result] @yieldparam [Result::Minute] result @return [Tops]
# File lib/vnstat/traffic/tops.rb, line 18 def each(&block) to_a.each(&block) end
to_a()
click to toggle source
@return [Array<Result::Minute>]
# File lib/vnstat/traffic/tops.rb, line 33 def to_a elements = traffic_data.xpath('tops/top') elements.map do |element| Result::Minute.extract_from_xml_element(element) end end