Sha256: 1bcb2ac813e7d1dd3640f82d6e5b82e889f0b603d3a32e4827fad3d991d85275
Contents?: true
Size: 952 Bytes
Versions: 7
Compression:
Stored size: 952 Bytes
Contents
# frozen_string_literal: true module Vnstat module Traffic ## # A class representing a collection of tracked tops. class Tops < Base ## # Iterates over all results in the collection. # # @overload each # @return [Enumerator] # # @overload each(&block) # @yield [result] # @yieldparam [Result::Minute] result # @return [Tops] def each(&block) to_a.each(&block) end ## # Fetches a single {Result::Minute} from the collection. # # @param [Integer] index The index of the entry in the collection. # @return [Result::Minute] def [](index) to_a[index] end ## # @return [Array<Result::Minute>] def to_a elements = traffic_data.xpath('tops/top') elements.map do |element| Result::Minute.extract_from_xml_element(element) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems