Module: Net::Openvpn::Parser::ServerConfig
- Defined in:
- lib/net/openvpn/parser/server_config.rb
Class Method Summary collapse
Class Method Details
.generate(config) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/net/openvpn/parser/server_config.rb', line 21 def generate(config) text = "" config.each do |key, value| text.concat "#{key} #{value}\n" end text end |
.parse(text) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/net/openvpn/parser/server_config.rb', line 7 def parse(text) config = {} text.each_line do |line| next if line =~ /^$/ parts = line.split(" ") key = parts.first value = parts[1..parts.size].join(" ") config[key.to_sym] = value end config end |