Class: Ifconf::Parsers::StatisticsGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/ifconf/parsers/statistics_group.rb

Overview

Frozen value object wrapping the RX/TX statistics lines from an ifconfig block. Extracts receive and transmit counters as hashes, plus collisions.

Constant Summary collapse

ZERO_RX =
{ packets: 0, bytes: 0, errors: 0, dropped: 0, overruns: 0, frame: 0 }.freeze
ZERO_TX =
{ packets: 0, bytes: 0, errors: 0, dropped: 0, overruns: 0, carrier: 0 }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ StatisticsGroup

Returns a new instance of StatisticsGroup.



11
12
13
14
# File 'lib/ifconf/parsers/statistics_group.rb', line 11

def initialize(block)
  extract_from(block)
  freeze
end

Instance Attribute Details

#collisionsObject (readonly)

Returns the value of attribute collisions.



9
10
11
# File 'lib/ifconf/parsers/statistics_group.rb', line 9

def collisions
  @collisions
end

#receiveObject (readonly)

Returns the value of attribute receive.



9
10
11
# File 'lib/ifconf/parsers/statistics_group.rb', line 9

def receive
  @receive
end

#transmitObject (readonly)

Returns the value of attribute transmit.



9
10
11
# File 'lib/ifconf/parsers/statistics_group.rb', line 9

def transmit
  @transmit
end

Instance Method Details

#present?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ifconf/parsers/statistics_group.rb', line 16

def present?
  @present
end