Sha256: e15bff0b0e71a81c6dc731a89784d3ff4a7f477916f631236ed74d80313ff7a2
Contents?: true
Size: 706 Bytes
Versions: 7
Compression:
Stored size: 706 Bytes
Contents
# frozen_string_literal: true module Vnstat module Traffic ## # A class encapsulating monthly tracking information. class Monthly < Base ## # Fetches a single {Result::Month} from the collection. # # @param [Integer] year # @param [Integer] month # @return [Result::Month] def [](year, month) entries_hash[[year, month]] end private def entries_hash elements = traffic_data.xpath('months/month') elements.each_with_object({}) do |element, hash| result = Result::Month.extract_from_xml_element(element) hash[[result.year, result.month]] = result end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems