lib/ruote/part/template.rb in ruote-2.1.11 vs lib/ruote/part/template.rb in ruote-2.2.0

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -39,11 +39,11 @@ # module TemplateMixin # Do the rendering. # - def render_template (template, flow_expression, workitem) + def render_template(template, flow_expression, workitem) template = (File.read(template) rescue nil) if is_a_file?(template) return render_default_template(workitem) unless template @@ -53,11 +53,11 @@ @context.dollar_sub.s(template, flow_expression, workitem) end # Simply returns a pretty-printed view of the workitem # - def render_default_template (workitem) + def render_default_template(workitem) workitem = workitem.to_h if workitem.respond_to?(:to_h) s = [] s << "workitem for #{workitem['participant_name']}" @@ -70,10 +70,10 @@ s.join("\n") end protected - def is_a_file? (s) + def is_a_file?(s) return false unless s return false if s.index("\n") File.exist?(s)