Method: Newman::Store#initialize
- Defined in:
- lib/newman/store.rb
#initialize(filename) ⇒ Store
To initialize a ‘Newman::Store` object, a `filename` string must be provided, i.e.
store = Newman::Store.new("simple.store")
This filename will be used to initialize a ‘PStore` object after first running `FileUtils.mkdir_p` to create any directories within the path to the filename if they do not already exist. Once that `PStore` object is created, two root keys will be mapped to empty Hash objects if they are not set already: `:indentifers` and `:columns`.
While it’s okay to treat the ‘PStore` object as an implementation detail, we will treat our interactions with it as part of Newman’s **external interface**, so that we are more conservative about making backwards incompatible changes to the databases created by ‘Newman::Store`.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/newman/store.rb', line 32 def initialize(filename) FileUtils.mkdir_p(File.dirname(filename)) self.data = PStore.new(filename) write do data[:identifiers] ||= {} data[:columns] ||= {} end end |