Class: Ifconf::Parsers::StatisticsGroup
- Inherits:
-
Object
- Object
- Ifconf::Parsers::StatisticsGroup
- 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
-
#collisions ⇒ Object
readonly
Returns the value of attribute collisions.
-
#receive ⇒ Object
readonly
Returns the value of attribute receive.
-
#transmit ⇒ Object
readonly
Returns the value of attribute transmit.
Instance Method Summary collapse
-
#initialize(block) ⇒ StatisticsGroup
constructor
A new instance of StatisticsGroup.
- #present? ⇒ Boolean
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
#collisions ⇒ Object (readonly)
Returns the value of attribute collisions.
9 10 11 |
# File 'lib/ifconf/parsers/statistics_group.rb', line 9 def collisions @collisions end |
#receive ⇒ Object (readonly)
Returns the value of attribute receive.
9 10 11 |
# File 'lib/ifconf/parsers/statistics_group.rb', line 9 def receive @receive end |
#transmit ⇒ Object (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
16 17 18 |
# File 'lib/ifconf/parsers/statistics_group.rb', line 16 def present? @present end |