Class: System::OpenvpnStatusLogParser

Inherits:
Object
  • Object
show all
Defined in:
lib/system/openvpn_status_log_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ OpenvpnStatusLogParser

Returns a new instance of OpenvpnStatusLogParser.



5
6
7
8
9
10
# File 'lib/system/openvpn_status_log_parser.rb', line 5

def initialize(text)
  @status = System::OpenvpnStatus.new
  @clients_block = false
  @text = text
  parse
end

Instance Attribute Details

#clients_blockObject

Returns the value of attribute clients_block.



3
4
5
# File 'lib/system/openvpn_status_log_parser.rb', line 3

def clients_block
  @clients_block
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/system/openvpn_status_log_parser.rb', line 3

def status
  @status
end

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/system/openvpn_status_log_parser.rb', line 3

def text
  @text
end

Instance Method Details

#parseObject



12
13
14
15
16
17
# File 'lib/system/openvpn_status_log_parser.rb', line 12

def parse
  @text.lines.each do |line|
    line_tokens = line.strip.split(',')
    parse_client_virtual_ips(line_tokens)
  end
end