Class: LastValueStore

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/test.rb,
lib/logstash/inputs/mongoprofile.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, name) ⇒ LastValueStore

Returns a new instance of LastValueStore.



120
121
122
# File 'lib/logstash/test.rb', line 120

def initialize(path, name)
  @file_full_name = "#{path}/#{name}"
end

Instance Method Details

#get_last_valueObject



133
134
135
# File 'lib/logstash/test.rb', line 133

def get_last_value
  File.read(@file_full_name)
end

#save_last_value(value) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/logstash/test.rb', line 124

def save_last_value(value)
  file = File.open(@file_full_name, 'a+')

  file.truncate(0)
  file.puts(value)

  file.close
end