Class: ROM::Session Private
- Inherits:
-
Object
- Object
- ROM::Session
- Defined in:
- lib/rom/repository/session.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
TODO: finish this in 1.1.0
Instance Attribute Summary collapse
- #queue ⇒ Object readonly private
- #repo ⇒ Object readonly private
- #status ⇒ Object readonly private
Instance Method Summary collapse
- #add(changeset) ⇒ Object private
- #commit! ⇒ Object private
- #failure? ⇒ Boolean private
-
#initialize(repo) ⇒ Session
constructor
private
A new instance of Session.
- #pending? ⇒ Boolean private
- #success? ⇒ Boolean private
Constructor Details
#initialize(repo) ⇒ Session
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Session.
18 19 20 21 22 |
# File 'lib/rom/repository/session.rb', line 18 def initialize(repo) @repo = repo @status = :pending initialize_queue! end |
Instance Attribute Details
#queue ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/rom/repository/session.rb', line 14 def queue @queue end |
#repo ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/rom/repository/session.rb', line 12 def repo @repo end |
#status ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/rom/repository/session.rb', line 16 def status @status end |
Instance Method Details
#add(changeset) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 |
# File 'lib/rom/repository/session.rb', line 24 def add(changeset) queue << changeset self end |
#commit! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rom/repository/session.rb', line 29 def commit! queue.each(&:commit) @status = :success self rescue StandardError => e @status = :failure raise e ensure initialize_queue! end |
#failure? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/rom/repository/session.rb', line 50 def failure? status.equal?(:failure) end |
#pending? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/rom/repository/session.rb', line 42 def pending? status.equal?(:pending) end |
#success? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/rom/repository/session.rb', line 46 def success? status.equal?(:success) end |