Object
Wrapping a flow expression and the current workitem as a Hash-like object ready for lookup at substitution time.
# File lib/ruote/svc/dollar_sub.rb, line 126 def [](key) return @fexp.fei.to_storage_id if key == 'fei' return @fexp.fei.wfid if key == 'wfid' return @fexp.fei.subid if key == 'subid' return @fexp.fei.subid if key == 'sub_wfid' # deprecated in 2.1.12 return @fexp.fei.expid if key == 'expid' return @fexp.fei.engine_id if key == 'engine_id' return @fexp.fei.mnemo_id if key == 'mnemo_id' return @workitem['fields']['__tags__'] if key == 'tags' return (@workitem['fields']['__tags__'] || []).last if key == 'tag' return (@workitem['fields']['__tags__'] || []).join('/') if key == 'full_tag' 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
# File lib/ruote/svc/dollar_sub.rb, line 191 def extract_prefix(key) i = key.index(':') return [ 'f', key ] if not i # 'f' is the default prefix (field, not variable) 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
# File lib/ruote/svc/dollar_sub.rb, line 181 def lookup(pr, key) case pr when 'v' then @fexp.lookup_variable(key) when 'f' then Ruote.lookup(@workitem['fields'], key) when 'r' then ruby_eval(key) else nil end end
TODO : rdoc me
# File lib/ruote/svc/dollar_sub.rb, line 208 def ruby_eval(ruby_code) raise ArgumentError.new( "'ruby_eval_allowed' is set to false, cannot evaluate >" + ruby_code + "< (http://ruote.rubyforge.org/dollar.html)" ) if @fexp.context['ruby_eval_allowed'] != true @fexp.context.treechecker.dollar_check(ruby_code) RubyContext.new(self).instance_eval(ruby_code) end
Generated with the Darkfish Rdoc Generator 2.