Class: Arxutils::TransactStateGroup

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(*names) ⇒ TransactStateGroup

初期化



37
38
39
40
41
# File 'lib/arxutils/transactstate.rb', line 37

def initialize( *names )
  @state = :NONE
  @inst = {}
  names.map{|x| @inst[x] = TransactState.new }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, lang = nil) ⇒ Object

指定名の状態を返す



66
67
68
# File 'lib/arxutils/transactstate.rb', line 66

def method_missing(name , lang = nil)
  @inst[name] 
end

Instance Method Details

#need?Boolean

処理の必要性の確認

Returns:

  • (Boolean)


44
45
46
# File 'lib/arxutils/transactstate.rb', line 44

def need?
  @state != :NONE
end

#resetObject

状態を:NONEに一括設定



60
61
62
63
# File 'lib/arxutils/transactstate.rb', line 60

def reset
  @state = :NONE
  set_all_inst_state
end

#set_all_inst_stateObject

状態の一括設定



49
50
51
# File 'lib/arxutils/transactstate.rb', line 49

def set_all_inst_state
  @inst.map{|x| x[1].state = @state }
end

#traceObject

状態を:TRACEに一括設定



54
55
56
57
# File 'lib/arxutils/transactstate.rb', line 54

def trace
  @state = :TRACE
  set_all_inst_state
end