Class: ActiveRecord::ConnectionAdapters::TransactionState
Relationships & Source Files | |
Inherits: | Object |
Defined in: | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb |
Class Method Summary
- .new(state = nil) ⇒ TransactionState constructor
Instance Attribute Summary
- #committed? ⇒ Boolean readonly
- #completed? ⇒ Boolean readonly
- #finalized? ⇒ Boolean readonly
- #fully_committed? ⇒ Boolean readonly
- #fully_completed? ⇒ Boolean readonly
- #fully_rolledback? ⇒ Boolean readonly
- #invalidated? ⇒ Boolean readonly
- #rolledback? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(state = nil) ⇒ TransactionState
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 6
def initialize(state = nil) @state = state @children = nil end
Instance Attribute Details
#committed? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 20
def committed? @state == :committed || @state == :fully_committed end
#completed? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 44
def completed? committed? || rolledback? end
#finalized? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 16
def finalized? @state end
#fully_committed? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 24
def fully_committed? @state == :fully_committed end
#fully_completed? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 40
def fully_completed? completed? end
#fully_rolledback? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 32
def fully_rolledback? @state == :fully_rolledback end
#invalidated? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 36
def invalidated? @state == :invalidated end
#rolledback? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 28
def rolledback? @state == :rolledback || @state == :fully_rolledback end
Instance Method Details
#add_child(state)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 11
def add_child(state) @children ||= [] @children << state end
#commit!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 63
def commit! @state = :committed end
#full_commit!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 67
def full_commit! @state = :fully_committed end
#full_rollback!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 53
def full_rollback! @children&.each { |c| c.rollback! } @state = :fully_rolledback end
#invalidate!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 58
def invalidate! @children&.each { |c| c.invalidate! } @state = :invalidated end
#nullify!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 71
def nullify! @state = nil end
#rollback!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 48
def rollback! @children&.each { |c| c.rollback! } @state = :rolledback end