Class: ROM::Session
- Inherits:
-
Object
- Object
- ROM::Session
- Defined in:
- lib/rom-session.rb,
lib/rom/session.rb,
lib/rom/session/state.rb,
lib/rom/session/mapper.rb,
lib/rom/session/tracker.rb,
lib/rom/session/version.rb,
lib/rom/session/relation.rb,
lib/rom/session/environment.rb,
lib/rom/session/identity_map.rb,
lib/rom/session/state/created.rb,
lib/rom/session/state/deleted.rb,
lib/rom/session/state/updated.rb,
lib/rom/session/state/persisted.rb,
lib/rom/session/state/transient.rb
Overview
Session with IdentityMap and state-tracking functionality
Defined Under Namespace
Classes: Environment, IdentityMap, Mapper, ObjectNotTrackedError, Relation, State, Tracker
Constant Summary collapse
- VERSION =
'0.1.1'.freeze
Class Method Summary collapse
-
.start(environment) {|| ... } ⇒ Object
Start a new session.
Instance Method Summary collapse
-
#[](relation_name) ⇒ Session::Relation
Return a session relation identified by name.
-
#clean? ⇒ Boolean
Return if there are any pending state changes.
-
#flush ⇒ Session
Flush this session committing all the state changes.
Class Method Details
.start(environment) {|| ... } ⇒ Object
Start a new session
36 37 38 |
# File 'lib/rom/session.rb', line 36 def self.start(environment) yield(new(Environment.build(environment))) end |
Instance Method Details
#[](relation_name) ⇒ Session::Relation
Return a session relation identified by name
47 48 49 |
# File 'lib/rom/session.rb', line 47 def [](relation_name) environment[relation_name] end |
#clean? ⇒ Boolean
Return if there are any pending state changes
66 67 68 |
# File 'lib/rom/session.rb', line 66 def clean? environment.clean? end |
#flush ⇒ Session
Flush this session committing all the state changes
56 57 58 59 |
# File 'lib/rom/session.rb', line 56 def flush environment.commit self end |