class Cooper::DataStore
Interface class for the cooper data store
Constants
- LOCATION
Public Class Methods
open()
click to toggle source
Calls superclass method
# File lib/cooper/datastore.rb, line 6 def self.open super(LOCATION, 'a+') end
Public Instance Methods
<<(attributes)
click to toggle source
# File lib/cooper/datastore.rb, line 14 def <<(attributes) puts attributes.to_json end
read(revision)
click to toggle source
# File lib/cooper/datastore.rb, line 18 def read(revision) readlines[0..revision] .each_with_object({}) { |line, item| item.merge!(JSON.parse(line)) } .reject { |_, v| v.nil? } end
reset()
click to toggle source
# File lib/cooper/datastore.rb, line 10 def reset truncate(0) end