Module: MemModel::RootedBase::ClassMethods
- Defined in:
- lib/mem_model/rooted_base.rb
Instance Method Summary collapse
- #abort ⇒ Object
- #commit ⇒ Object
- #container_key ⇒ Object
- #persistent(&block) ⇒ Object
- #root ⇒ Object
- #root_container ⇒ Object
- #store ⇒ Object
Instance Method Details
#abort ⇒ Object
26 27 28 29 |
# File 'lib/mem_model/rooted_base.rb', line 26 def abort Maglev.abort_transaction if maglev? true end |
#commit ⇒ Object
31 32 33 34 |
# File 'lib/mem_model/rooted_base.rb', line 31 def commit Maglev.commit_transaction if maglev? true end |
#container_key ⇒ Object
13 14 15 |
# File 'lib/mem_model/rooted_base.rb', line 13 def container_key name.to_sym end |
#persistent(&block) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/mem_model/rooted_base.rb', line 36 def persistent(&block) abort maglev? ? Maglev.persistent { block.call } : block.call commit end |
#root ⇒ Object
22 23 24 |
# File 'lib/mem_model/rooted_base.rb', line 22 def root @root ||= root_container::PERSISTENT_ROOT end |
#root_container ⇒ Object
9 10 11 |
# File 'lib/mem_model/rooted_base.rb', line 9 def root_container MemModel.maglev? ? Maglev : MemModel end |
#store ⇒ Object
17 18 19 20 |
# File 'lib/mem_model/rooted_base.rb', line 17 def store root[:MemModel] ||= {} root[:MemModel][container_key] ||= store_class.new end |