Class: Lims::Core::Persistence::Store
- Inherits:
-
Object
- Object
- Lims::Core::Persistence::Store
- Defined in:
- lib/lims-core/persistence/store.rb
Overview
A store represents a persistent datastore, where object can be saved and restored. A connection to a database, for example.
Direct Known Subclasses
Constant Summary
- DIRTY_ATTRIBUTE_STRATEGY_DEEP_COPY =
1
- DIRTY_ATTRIBUTE_STRATEGY_SHA1 =
2
- DIRTY_ATTRIBUTE_STRATEGY_MD5 =
3
- DIRTY_ATTRIBUTE_STRATEGY_QUICK_HASH =
4
Instance Attribute Summary (collapse)
-
- (Object) dirty_attribute_strategy
Returns the value of attribute dirty_attribute_strategy.
Class Method Summary (collapse)
-
+ (Module) base_module
Retrieves the effective module of a class Useful to call "sibling" classes.
- + (Object) const_missing(name)
Instance Method Summary (collapse)
- - (Object) base_module
-
- (Object) create_session(*params)
Create a session If a session is given a parameter return in instead of creating a new one.
-
- (Object) transaction
Execute given block within a transaction If it make sense.
-
- (Object) with_session(*params) {|session| ... }
Create a session and pass it to the block.
Instance Attribute Details
- (Object) dirty_attribute_strategy
Returns the value of attribute dirty_attribute_strategy
19 20 21 |
# File 'lib/lims-core/persistence/store.rb', line 19 def dirty_attribute_strategy @dirty_attribute_strategy end |
Class Method Details
+ (Module) base_module
Retrieves the effective module of a class Useful to call "sibling" classes.
37 38 39 40 41 42 |
# File 'lib/lims-core/persistence/store.rb', line 37 def self.base_module @base_module ||= begin base_name = name.sub(/::\w+$/, '') constant(base_name) end end |
+ (Object) const_missing(name)
12 13 14 |
# File 'lib/lims-core/persistence/store.rb', line 12 def self.const_missing(name) super(name) end |
Instance Method Details
- (Object) base_module
43 44 45 |
# File 'lib/lims-core/persistence/store.rb', line 43 def base_module self.class.base_module end |
- (Object) create_session(*params)
Create a session If a session is given a parameter return in instead of creating a new one.
60 61 62 63 |
# File 'lib/lims-core/persistence/store.rb', line 60 def create_session(*params) return params.first if(params.size >= 1 && params.first.is_a?(Session)) base_module::Session.new(self, *params) end |
- (Object) transaction
Execute given block within a transaction If it make sense.
67 68 69 |
# File 'lib/lims-core/persistence/store.rb', line 67 def transaction yield end |
- (Object) with_session(*params) {|session| ... }
Create a session and pass it to the block. This is the only way to get a session.
52 53 54 |
# File 'lib/lims-core/persistence/store.rb', line 52 def with_session(*params, &block) create_session(*params).with_session(&block) end |