Class: Metastore::Storage::Base
- Inherits:
-
Object
- Object
- Metastore::Storage::Base
- Defined in:
- lib/metastore/storage/base.rb
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(file) ⇒ Base
constructor
A new instance of Base.
- #save!(values) ⇒ Object
Constructor Details
#initialize(file) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/metastore/storage/base.rb', line 7 def initialize(file) @file = file end |
Instance Method Details
#contents ⇒ Object
11 12 13 |
# File 'lib/metastore/storage/base.rb', line 11 def contents file.exist? ? read : {} end |
#save!(values) ⇒ Object
15 16 17 |
# File 'lib/metastore/storage/base.rb', line 15 def save!(values) File.open(file.to_s, 'w') { |f| f.write(to_write(values)) } end |