Module: CiInACan::Persistence
- Defined in:
- lib/ci_in_a_can/persistence.rb
Class Method Summary collapse
Class Method Details
.find(type, id) ⇒ Object
12 13 14 15 |
# File 'lib/ci_in_a_can/persistence.rb', line 12 def self.find type, id store = store_for(type) store.transaction(true) { store[id] } end |
.hash_for(type) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ci_in_a_can/persistence.rb', line 17 def self.hash_for type store = store_for(type) store.transaction do store.roots.inject({}) { |t, i| t[i] = store[i]; t } end end |
.save(type, id, value) ⇒ Object
7 8 9 10 |
# File 'lib/ci_in_a_can/persistence.rb', line 7 def self.save type, id, value store = store_for(type) store.transaction { store[id] = value } end |