class Hieraviz::Facts
class for storage and retrieval of customized facts that can overlay hiera facts
Public Class Methods
new(tmpdir, base, node, user)
click to toggle source
# File lib/hieraviz/facts.rb, line 5 def initialize(tmpdir, base, node, user) @filename = File.join(tmpdir, "#{base}__#{node}__#{user}") end
Public Instance Methods
exist?()
click to toggle source
# File lib/hieraviz/facts.rb, line 9 def exist? File.exist? @filename end
read()
click to toggle source
# File lib/hieraviz/facts.rb, line 13 def read if exist? Marshal.load(File.binread(@filename)) else {} end end
remove()
click to toggle source
# File lib/hieraviz/facts.rb, line 25 def remove File.unlink @filename end
write(data)
click to toggle source
# File lib/hieraviz/facts.rb, line 21 def write(data) File.open(@filename, 'wb') { |file| file.write(Marshal.dump(data)) } end