lib/ruote/util/dollar.rb in ruote-2.1.4 vs lib/ruote/util/dollar.rb in ruote-2.1.5
- old
+ new
@@ -74,12 +74,13 @@
@default_prefix = default_prefix
end
def [] (key)
+ return @fexp.fei.to_storage_id if key == 'fei'
return @fexp.fei.wfid if key == 'wfid'
- return @fexp.fei.parent_wfid if key == 'parent_wfid'
+ return @fexp.fei.sub_wfid if key == 'sub_wfid'
return @fexp.fei.expid if key == 'expid'
pr, k = extract_prefix(key)
# stage 0
@@ -147,15 +148,17 @@
# The ${r:1+2} stuff. ("3").
#
def call_ruby (ruby_code)
- return '' if @fexp.context[:ruby_eval_allowed] != true
+ return '' if @fexp.context['ruby_eval_allowed'] != true
- wi = @workitem
- workitem = @workitem
+ engine_id = @fexp.context.engine_id
+ wi = Ruote::Workitem.new(@workitem)
+ workitem = wi
+
fe = @fexp
fexp = @fexp
flow_expression = @fexp
fei = @fexp.fei
#
@@ -166,9 +169,24 @@
# clear for eval...
eval(ruby_code, binding()).to_s
end
- end
+ # This 'd' function can be called from inside ${r:...} notations.
+ #
+ # pdef = Ruote.process_definition do
+ # sequence do
+ # set 'f:toto' => 'person'
+ # echo "${r:d('f:toto')}"
+ # end
+ # end
+ #
+ # will yield "person".
+ #
+ def d (s)
+
+ Rufus.dsub("${#{s}}", self)
+ end
+ end
end