Class | OpenWFE::AttributeExpression |
In: |
lib/openwfe/expressions/fe_fqv.rb
|
Parent: | FlowExpression |
The ‘a’ or ‘attribute’ expression. Directly describing some variable or list content in XML or in YAML.
_set :field => "list" do _a """ <list> <string>a</string> <string>b</string> <string>c</string> </list> """ end
or
_set :field => "list" do _attribute """ --- - a - b - c """ end
Note that it‘s actually easier to write :
_set :filed => "list" do reval "[ 'a', 'b', 'c' ]" end
but it‘s less secure.
# File lib/openwfe/expressions/fe_fqv.rb, line 156 156: def apply workitem 157: 158: #text = fetch_text_content workitem 159: #text = text.strip 160: #result = if text[0, 3] == "---" 161: # YAML.load text 162: #else 163: # d = REXML::Document.new text 164: # XmlCodec::decode_attribute d.root 165: #end 166: 167: child = @children.first 168: 169: text = if child.is_a?(String) 170: 171: child 172: 173: elsif child.is_a?(FlowExpressionId) 174: 175: exp = get_expression_pool.fetch_expression child 176: ExpressionTree.to_s exp.raw_representation 177: 178: else 179: 180: child.to_s 181: end 182: 183: text = text.strip 184: 185: result = if text[0, 3] == '---' 186: YAML.load text 187: else 188: d = REXML::Document.new text 189: XmlCodec::decode_attribute d.root 190: end 191: 192: workitem.set_result(result) if result != nil 193: 194: reply_to_parent workitem 195: end