store.rb |
|
---|---|
For an example of how
|
module Newman
class Store |
|
|
To initialize a
This filename will be used to initialize a While it’s okay to treat the |
def initialize(filename)
FileUtils.mkdir_p(File.dirname(filename))
self.data = PStore.new(filename)
write do
data[:identifiers] ||= {}
data[:columns] ||= {}
end
end |
|
|
This method is functionally equivalent to the following code:
For aesthetic reasons and for forward compatibility, it is
preferable to use |
def [](column_key)
Recorder.new(column_key, self)
end |
|
|
|
def read
data.transaction(:read_only) { yield(data) }
end |
|
|
|
def write
data.transaction { yield(data) }
end |
|
|
NOTE: Methods below this point in the file are implementation details, and should not be depended upon |
private |
|
|
The |
attr_accessor :data
end
end |