10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/state_flow/base.rb', line 10
def process_state(selectable_attr, *keys, &block)
options = {
:transactional => false,
}.update(keys.)
options[:transactional] = :each if options[:transactional] == true
state_flow = state_flow_for(selectable_attr)
raise ArgumentError, "state_flow not found: #{selectable_attr.inspect}" unless state_flow
transaction_if_need(options[:transactional] == :all) do
keys.each do |key|
entry = state_flow[key]
raise ArgumentError, "entry not found: #{key.inspect}" unless entry
transaction_if_need(options[:transactional] == :each) do
entry.process(&block)
end
end
end
end
|