lib/mcp/common/templates.rb
# Run the template with the given parameters and return
# the template with the values replaced
Run the template with the given parameters and return
the template with the values replaced
Run the template with the given parameters and return the template with the values replaced
def run()
        out_str = @template.clone()
        @replace_strs.keys.each { |replace_str|
          out_str.gsub!( /#{replace_str}(.*?)#{replace_str}/ ) {
            begin
              val = @replace_strs[ replace_str ].call( $1 )
            rescue IndexError => e
              raise McastTemplateException.new, "Unknown key '#{$1}' found in template"
            end
            val.to_s
          }
        }
        out_str
      end
def run ( ) out_str = @template . clone ( ) @replace_strs . keys . each { | replace_str | out_str . gsub! ( / #{ replace_str } (.*?) #{ replace_str } / ) { begin val = @replace_strs [ replace_str ] . call ( $1 ) rescue IndexError => e raise McastTemplateException . new , "Unknown key '#{$1}' found in template" end val . to_s } } out_str end
Run the template with the given parameters and return
the template with the values replaced
Run the template with the given parameters and return the template with the values replaced