Class: ActiveRecord::ConnectionAdapters::TransactionState
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb
Instance Method Summary collapse
- #add_child(state) ⇒ Object
- #commit! ⇒ Object
- #committed? ⇒ Boolean
- #completed? ⇒ Boolean
- #finalized? ⇒ Boolean
- #full_commit! ⇒ Object
- #full_rollback! ⇒ Object
- #fully_committed? ⇒ Boolean
- #fully_completed? ⇒ Boolean
- #fully_rolledback? ⇒ Boolean
-
#initialize(state = nil) ⇒ TransactionState
constructor
A new instance of TransactionState.
- #invalidate! ⇒ Object
- #invalidated? ⇒ Boolean
- #nullify! ⇒ Object
- #rollback! ⇒ Object
- #rolledback? ⇒ Boolean
Constructor Details
#initialize(state = nil) ⇒ TransactionState
Returns a new instance of TransactionState.
6 7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 6 def initialize(state = nil) @state = state @children = nil end |
Instance Method Details
#add_child(state) ⇒ Object
11 12 13 14 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 11 def add_child(state) @children ||= [] @children << state end |
#commit! ⇒ Object
63 64 65 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 63 def commit! @state = :committed end |
#committed? ⇒ Boolean
20 21 22 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 20 def committed? @state == :committed || @state == :fully_committed end |
#completed? ⇒ Boolean
44 45 46 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 44 def completed? committed? || rolledback? end |
#finalized? ⇒ Boolean
16 17 18 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 16 def finalized? @state end |
#full_commit! ⇒ Object
67 68 69 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 67 def full_commit! @state = :fully_committed end |
#full_rollback! ⇒ Object
53 54 55 56 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 53 def full_rollback! @children&.each { |c| c.rollback! } @state = :fully_rolledback end |
#fully_committed? ⇒ Boolean
24 25 26 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 24 def fully_committed? @state == :fully_committed end |
#fully_completed? ⇒ Boolean
40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 40 def fully_completed? completed? end |
#fully_rolledback? ⇒ Boolean
32 33 34 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 32 def fully_rolledback? @state == :fully_rolledback end |
#invalidate! ⇒ Object
58 59 60 61 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 58 def invalidate! @children&.each { |c| c.invalidate! } @state = :invalidated end |
#invalidated? ⇒ Boolean
36 37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 36 def invalidated? @state == :invalidated end |
#nullify! ⇒ Object
71 72 73 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 71 def nullify! @state = nil end |
#rollback! ⇒ Object
48 49 50 51 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 48 def rollback! @children&.each { |c| c.rollback! } @state = :rolledback end |
#rolledback? ⇒ Boolean
28 29 30 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/transaction.rb', line 28 def rolledback? @state == :rolledback || @state == :fully_rolledback end |