class Droxy::ResolverFile
Attributes
tld[R]
Public Class Methods
new(tld: @tld = tld)
click to toggle source
# File lib/droxy/resolver_file.rb, line 5 def initialize tld: @tld = tld end
Public Instance Methods
path()
click to toggle source
# File lib/droxy/resolver_file.rb, line 9 def path "/etc/resolver/#{tld}" end
read_port()
click to toggle source
# File lib/droxy/resolver_file.rb, line 24 def read_port @_read_port ||= File.read(path) =~ /^port (\d+)/ && Integer($1) end
remove()
click to toggle source
# File lib/droxy/resolver_file.rb, line 20 def remove FileUtils.rm path end
write(port: File.write path, <<-EOF)
click to toggle source
# File lib/droxy/resolver_file.rb, line 13 def write port: File.write path, <<-EOF nameserver 127.0.0.1 port #{port} EOF end