Class: Vnstat::Traffic::Base

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/vnstat/traffic/base.rb

Overview

An abstract implementation for a traffic collection.

Direct Known Subclasses

Daily, Hourly, Monthly, Tops

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interface) ⇒ Base

Initializes the traffic collection.

Parameters:

  • interface (Interface)

    The tracked interface.



18
19
20
# File 'lib/vnstat/traffic/base.rb', line 18

def initialize(interface)
  @interface = interface
end

Instance Attribute Details

#interfaceInterface (readonly)

The tracked interface.

Returns:

  • (Interface)

    the current value of interface



9
10
11
# File 'lib/vnstat/traffic/base.rb', line 9

def interface
  @interface
end

Instance Method Details

#eachEnumerator #each {|result| ... } ⇒ Base

Iterates over all results in the collection.

Overloads:

  • #eachEnumerator

    Returns:

    • (Enumerator)
  • #each {|result| ... } ⇒ Base

    Yields:

    • (result)

    Yield Parameters:

    Returns:



32
33
34
# File 'lib/vnstat/traffic/base.rb', line 32

def each(&block)
  entries_hash.values.each(&block)
end