lib/openwfe/participants/atomparticipants.rb in openwferu-0.9.4 vs lib/openwfe/participants/atomparticipants.rb in openwferu-0.9.5
- old
+ new
@@ -68,10 +68,16 @@
# <p>
# <h1>${f:colour}</h1>
# </p>
# """) # the template for each entry
#
+ # The 'template' parameter may contain an instance of File instead of
+ # an instance of String.
+ #
+ # feed0 = AtomParticipant.new(
+ # 20, File.new("path/to/my/atom/template.txt")
+ #
# The template can be passed as the second parameter (after the max entry
# count) or as a block :
#
# feed1 = AtomParticipant.new(20) do |flow_expression, atom_participant, workitem|
# #
@@ -142,11 +148,17 @@
fe = get_flow_expression(workitem)
template = if @block_template
@block_template.call(fe, self, workitem)
+ elsif @template
+ if @template.kind_of? File
+ @template.readlines
+ else
+ @template.to_s
+ end
else
- @template
+ "(no template given)"
end
return OpenWFE::dosub(template, fe, workitem)
end