Class: LastValueStore
- Inherits:
-
Object
- Object
- LastValueStore
- Defined in:
- lib/mongo/mongo.rb
Instance Method Summary collapse
- #get_last_value ⇒ Object
-
#initialize(path, name) ⇒ LastValueStore
constructor
A new instance of LastValueStore.
- #save_last_value(value) ⇒ Object
Constructor Details
#initialize(path, name) ⇒ LastValueStore
Returns a new instance of LastValueStore.
63 64 65 |
# File 'lib/mongo/mongo.rb', line 63 def initialize(path, name) @file_full_name = "#{path}/#{name}" end |
Instance Method Details
#get_last_value ⇒ Object
76 77 78 |
# File 'lib/mongo/mongo.rb', line 76 def get_last_value File.read(@file_full_name) end |
#save_last_value(value) ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/mongo/mongo.rb', line 67 def save_last_value(value) file = File.open(@file_full_name, 'a+') file.truncate(0) file.puts(value) file.close end |