Class: ProcNetParser

Inherits:
Object
  • Object
show all
Defined in:
lib/myer/proc_net_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#received_bytesObject (readonly)

Returns the value of attribute received_bytes.



2
3
4
# File 'lib/myer/proc_net_parser.rb', line 2

def received_bytes
  @received_bytes
end

Instance Method Details

#parse(input) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/myer/proc_net_parser.rb', line 4

def parse(input)
  input.each_line do |line|
    if line =~ /^en(.*):\s+(\d+)\s+/
      @received_bytes = $2.to_i
    end
  end
end