class Vnstat::Result::Minute
A class representing a tracking result for a specific minute.
@!attribute [r] time
@return [DateTime] The time the result was captured at.
Attributes
time[R]
Public Class Methods
extract_from_xml_element(element)
click to toggle source
Initializes a {Minute} using the the data contained in the given XML element.
@param [Nokogiri::XML::Element] element The XML element. @return [Minute]
# File lib/vnstat/result/minute.rb, line 33 def self.extract_from_xml_element(element) new( Parser.extract_datetime_from_xml_element(element), *Parser.extract_transmitted_bytes_from_xml_element(element) ) end
new(time, bytes_received, bytes_sent)
click to toggle source
Initializes the {Minute}.
@param [DateTime] time The time the result was captured at. @param [Integer] bytes_received The received bytes. @param [Integer] bytes_sent The sent bytes.
Calls superclass method
Vnstat::Result::new
# File lib/vnstat/result/minute.rb, line 22 def initialize(time, bytes_received, bytes_sent) @time = time super(bytes_received, bytes_sent) end
Public Instance Methods
date()
click to toggle source
The date the result was captured.
@return [Date]
# File lib/vnstat/result/minute.rb, line 44 def date time.to_date end
hour()
click to toggle source
The hour the result was captured.
@return [Integer]
# File lib/vnstat/result/minute.rb, line 52 def hour time.hour end
minute()
click to toggle source
The minute the result was captured.
@return [Integer]
# File lib/vnstat/result/minute.rb, line 60 def minute time.min end