class FileHandler

Public Class Methods

new(path) click to toggle source
# File lib/logstash/inputs/value_tracking.rb, line 51
def initialize(path)
  @path = path
  @exists = ::File.exist?(@path)
end

Public Instance Methods

clean() click to toggle source
# File lib/logstash/inputs/value_tracking.rb, line 56
def clean
  return unless @exists
  ::File.delete(@path)
  @exists = false
end
read() click to toggle source
# File lib/logstash/inputs/value_tracking.rb, line 62
def read
  return unless @exists
  YAML.load(::File.read(@path))
end
write(value) click to toggle source
# File lib/logstash/inputs/value_tracking.rb, line 67
def write(value)
  ::File.write(@path, YAML.dump(value))
  @exists = true
end