Object
The FlowExpressionId (fei for short) is an process expression identifier. Each expression when instantiated gets a unique fei.
Feis are also used in workitems, where the fei is the fei of the
expression that emitted the workitem.
Feis can thus indicate the position of a workitem in a process tree.
Feis contain four pieces of information :
Returns child_id... For an expid of '0_1_4', this will be 4.
# File lib/ruote/fei.rb, line 143 def self.child_id (h) h['expid'].split(CHILD_SEP).last.to_i end
# File lib/ruote/fei.rb, line 151 def self.direct_child? (parent_fei, other_fei) ] sub_wfid wfid engine_id ].each do |k| return false if parent_fei[k] != other_fei[k] end pei = other_fei['expid'].split(CHILD_SEP)[0..-2].join(CHILD_SEP) (pei == parent_fei['expid']) end
Attempts at extracting a FlowExpressionId from the given argument (workitem, string, ...)
Uses .extract_h
# File lib/ruote/fei.rb, line 167 def self.extract (arg) FlowExpressionId.new(extract_h(arg)) end
Attempts at extracting a FlowExpressionId (as a Hash instance) from the given argument (workitem, string, ...)
# File lib/ruote/fei.rb, line 175 def self.extract_h (arg) if arg.is_a?(Hash) return arg if arg['expid'] return arg['fei'] if arg['fei'] end return extract_h(arg.fei) if arg.respond_to?(:fei) return arg.h if arg.is_a?(Ruote::FlowExpressionId) return arg.h['fei'] if arg.is_a?(Ruote::Workitem) if arg.is_a?(String) ss = arg.split('!') return { 'engine_id' => ss[-4] || 'engine', 'expid' => ss[-3], 'sub_wfid' => ss[-2], 'wfid' => ss[-1] } end raise ArgumentError.new( "couldn't extract fei out of instance of #{arg.class}") end
Turns the result of to_storage_id back to a FlowExpressionId instance.
# File lib/ruote/fei.rb, line 108 def self.from_id (s, engine_id='engine') extract("#{engine_id}!#{s}") end
Returns true if the h is a representation of a FlowExpressionId instance.
# File lib/ruote/fei.rb, line 135 def self.is_a_fei? (h) h.respond_to?(:keys) && (h.keys - [ 'sub_wfid' ]).sort == ] engine_id expid wfid ] end
# File lib/ruote/fei.rb, line 124 def == (other) return false unless other.is_a?(Ruote::FlowExpressionId) (hash == other.hash) end
Returns the last number in the expid. For instance, if the expid is '0_5_7', the child_id will be '7'.
# File lib/ruote/fei.rb, line 116 def child_id h.expid.split(CHILD_SEP).last.to_i end
# File lib/ruote/fei.rb, line 91 def engine_id @h['engine_id'] end
Generated with the Darkfish Rdoc Generator 2.