Class: Arxutils::TransactState

Inherits:
Object
  • Object
show all
Defined in:
lib/arxutils/transactstate.rb

Overview

簡易的なトランザクション処理

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransactState

初期化



10
11
12
13
14
15
# File 'lib/arxutils/transactstate.rb', line 10

def initialize
# 対象ID群
  @ids = []
# 状態
  @state = :NONE
end

Instance Attribute Details

#idsObject (readonly)

対象ID群



5
6
7
# File 'lib/arxutils/transactstate.rb', line 5

def ids
  @ids
end

#stateObject

状態



7
8
9
# File 'lib/arxutils/transactstate.rb', line 7

def state
  @state
end

Instance Method Details

#add(xid) ⇒ Object

:TRACE状態の時のみ対象IDとして追加



18
19
20
# File 'lib/arxutils/transactstate.rb', line 18

def add( xid )
  @ids << xid if @state == :TRACE
end

#clearObject

対象ID群をクリア



23
24
25
# File 'lib/arxutils/transactstate.rb', line 23

def clear
  @ids = []
end

#need?Boolean

処理の必要性の確認

Returns:

  • (Boolean)


28
29
30
# File 'lib/arxutils/transactstate.rb', line 28

def need?
  @ids.size > 0
end