class Vnstat::Traffic::Base

An abstract implementation for a traffic collection.

@attr_reader [Interface] interface The tracked interface.

Attributes

interface[R]

Public Class Methods

new(interface) click to toggle source

Initializes the traffic collection.

@param [Interface] interface The tracked interface.

# File lib/vnstat/traffic/base.rb, line 18
def initialize(interface)
  @interface = interface
end

Public Instance Methods

each(&block) click to toggle source

Iterates over all results in the collection.

@overload each

@return [Enumerator]

@overload each(&block)

@yield [result]
@yieldparam [Result] result
@return [Base]
# File lib/vnstat/traffic/base.rb, line 32
def each(&block)
  entries_hash.values.each(&block)
end

Private Instance Methods

traffic_data() click to toggle source
# File lib/vnstat/traffic/base.rb, line 38
def traffic_data
  interface.data.xpath('//traffic')
end