def s(text, flow_expression, workitem)

      if text.is_a?(String)

        literal_sub(
          Rufus.dsub(text, dict_class.new(flow_expression, workitem)),
          flow_expression,
          workitem)

      elsif text.is_a?(Array)

        text.collect { |e| s(e, flow_expression, workitem) }

      elsif text.is_a?(Hash)

        text.remap { |(k, v), h|
          h[s(k, flow_expression, workitem)] = s(v, flow_expression, workitem)
        }

      else

        text
      end
    end
def s(text, flow_expression, workitem)

      if text.is_a?(String)

        literal_sub(
          Rufus.dsub(text, dict_class.new(flow_expression, workitem)),
          flow_expression,
          workitem)

      elsif text.is_a?(Array)

        text.collect { |e| s(e, flow_expression, workitem) }

      elsif text.is_a?(Hash)

        text.remap { |(k, v), h|
          h[s(k, flow_expression, workitem)] = s(v, flow_expression, workitem)
        }

      else

        text
      end
    end
Performs 'dollar substitution' on a piece of text with as input
 a flow expression and a workitem (fields and variables).

 With help from Nick Petrella (2008/03/20)