class Net::Openvpn::Server
Public Class Methods
new(name)
click to toggle source
# File lib/net/openvpn/server.rb, line 5 def initialize(name) @name = name load if exists? end
Public Instance Methods
exists?()
click to toggle source
# File lib/net/openvpn/server.rb, line 26 def exists? File.exists? path end
get(key)
click to toggle source
# File lib/net/openvpn/server.rb, line 14 def get(key) @config[key] end
load()
click to toggle source
# File lib/net/openvpn/server.rb, line 10 def load @config = Net::Openvpn::Parser::ServerConfig.parse(File.read(path)) end
path()
click to toggle source
# File lib/net/openvpn/server.rb, line 22 def path Net::Openvpn.basepath "#{@name}.conf" end
save()
click to toggle source
# File lib/net/openvpn/server.rb, line 30 def save text = Net::Openvpn::Parser::ServerConfig.generate(@config) File.open(path, "w") do |f| f.puts text end end
set(key, value)
click to toggle source
# File lib/net/openvpn/server.rb, line 18 def set(key, value) @config[key] = value end