lib/openwfe/omixins.rb in openwferu-0.9.11 vs lib/openwfe/omixins.rb in openwferu-0.9.12
- old
+ new
@@ -47,24 +47,47 @@
#
# A few methods about FlowExpressionIds
#
module FeiMixin
- #
- # Makes sure to return a FlowExpressionId instance.
- #
- def extract_fei (object)
+ protected
- if object.kind_of?(FlowExpressionId)
- object
- elsif object.kind_of?(FlowExpression) or object.kind_of?(InFlowItem)
- object.fei
- elsif object.kind_of?(String)
- FlowExpressionId.to_fei object
- else
- raise "cannot extract FlowExpressionId out of #{object.inspect}"
+ #
+ # Makes sure to return a FlowExpressionId instance.
+ #
+ def extract_fei (object)
+
+ if object.kind_of?(FlowExpressionId)
+
+ object
+
+ elsif object.kind_of?(FlowExpression) or
+ object.kind_of?(InFlowItem)
+
+ object.fei
+
+ elsif object.kind_of?(String)
+
+ FlowExpressionId.to_fei object
+
+ else
+
+ raise \
+ "cannot extract FlowExpressionId "+
+ "out of #{object.inspect}"
+ end
end
- end
+
+ #
+ # A small method for ensuring we have a workflow instance id.
+ #
+ def to_wfid (fei_or_wfid)
+ wfid = fei_or_wfid
+ wfid = wfid.parent_wfid if wfid.kind_of?(FlowExpressionId)
+ wfid.to_s
+ end
+
+ alias :extract_wfid :to_wfid
end
end