Module: SSD::InstanceMethods
- Defined in:
- lib/ssd/instance_methods.rb
Instance Attribute Summary collapse
-
#ssd ⇒ Object
Returns the value of attribute ssd.
Class Method Summary collapse
Instance Method Summary collapse
- #[]= ⇒ Object (also: #append!, #save!, #store!)
- #transaction ⇒ Object
Instance Attribute Details
#ssd ⇒ Object
Returns the value of attribute ssd.
8 9 10 |
# File 'lib/ssd/instance_methods.rb', line 8 def ssd @ssd end |
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/ssd/instance_methods.rb', line 4 def self.included(base) @@ssd_name = base.new.class.to_s.downcase end |
Instance Method Details
#[]= ⇒ Object Also known as: append!, save!, store!
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ssd/instance_methods.rb', line 27 def []= 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 |
#transaction ⇒ Object
20 21 22 23 24 25 |
# File 'lib/ssd/instance_methods.rb', line 20 def transaction @@ssd_db.transaction do yield @@ssd_db @@ssd_db.commit end end |