Object
Wrapping a process expression and the current workitem as a Hash object ready for lookup at substitution time.
# File lib/ruote/util/dollar.rb, line 78 def [] (key) return @fexp.fei.to_storage_id if key == 'fei' return @fexp.fei.wfid if key == 'wfid' return @fexp.fei.sub_wfid if key == 'sub_wfid' return @fexp.fei.expid if key == 'expid' pr, k = extract_prefix(key) # stage 0 v = lookup(pr[0, 1], k) return v if v != nil # stage 1 return '' if pr.size < 2 lookup(pr[1, 1], k) end
The ${r:1+2} stuff. ("3").
# File lib/ruote/util/dollar.rb, line 152 def call_ruby (ruby_code) return '' if @fexp.context['ruby_eval_allowed'] != true engine_id = @fexp.context.engine_id wi = Ruote::Workitem.new(@workitem) workitem = wi fe = @fexp fexp = @fexp flow_expression = @fexp fei = @fexp.fei # # some simple notations made available to ${ruby:...} # notations @fexp.context.treechecker.check(ruby_code) # clear for eval... eval(ruby_code, binding()).to_s 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".
# File lib/ruote/util/dollar.rb, line 187 def d (s) Rufus.dsub("${#{s}}", self) end
# File lib/ruote/util/dollar.rb, line 136 def extract_prefix (key) i = key.index(':') return [ @default_prefix, key ] if not i pr = key[0..i-1] # until ':' pr = pr[0, 2] # the first two chars pr = pr[0, 1] unless (pr == 'vf') or (pr == 'fv') [ pr, key[i+1..-1] ] end
Generated with the Darkfish Rdoc Generator 2.