Class: Gamma::SyncDatabase
- Inherits:
-
Object
- Object
- Gamma::SyncDatabase
- Defined in:
- lib/gamma/sync_database.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ SyncDatabase
constructor
A new instance of SyncDatabase.
- #save ⇒ Object
Constructor Details
#initialize(path) ⇒ SyncDatabase
Returns a new instance of SyncDatabase.
2 3 4 5 6 7 8 9 |
# File 'lib/gamma/sync_database.rb', line 2 def initialize(path) @sync_history_path = path @database = if File.exists?(@sync_history_path) JSON.parse(open(@sync_history_path).read) else {} end end |
Instance Method Details
#save ⇒ Object
11 12 13 14 15 |
# File 'lib/gamma/sync_database.rb', line 11 def save open(@sync_history_path, "w") do |io| JSON.dump(@database, io) end end |