module SSD::Internals::Entity::InstanceMethods
Attributes
ssd[RW]
Public Class Methods
included(base)
click to toggle source
# File lib/ssd/instance_methods.rb, line 6 def self.included(base) @@ssd_name = base.new.class.to_s.downcase end
Public Instance Methods
[]=()
click to toggle source
# File lib/ssd/instance_methods.rb, line 29 def []= @@ssd_path = ".ssd/#{@@ssd_name}/#{@ssd}.ssd" @@ssd_db = PStore.new @@ssd_path, true begin if !@ssd.nil? then @@ssd_db.transaction do #todo should be somthing like??? timestamp instead of ssd as a key?? and use .last while reading @@ssd_db[Time.now.utc.to_s + "_" + Random.new_seed.to_s ] = self end else raise 'ssd key can not be nil. see more (documentation url)' end end end
ssd=(value)
click to toggle source
# File lib/ssd/instance_methods.rb, line 12 def ssd= value @ssd = value FileUtils::mkdir_p ".ssd/#{@@ssd_name}" @@ssd_path = ".ssd/#{@@ssd_name}/#{@ssd}.ssd" @@ssd_db = PStore.new @@ssd_path, true @@ssd_db.ultra_safe = true @@ssd_db.transaction(true) {} return @@ssd_db end
transaction() { |ssd_db| ... }
click to toggle source
# File lib/ssd/instance_methods.rb, line 22 def transaction @@ssd_db.transaction do yield @@ssd_db @@ssd_db.commit end end