module Parade::Commands::RenderFromTemplate
A module that shares common methods and information.
Public Instance Methods
create_file_with_contents(filename,contents,options)
click to toggle source
@param [String] filename the file name to save the file @param [String] contents the contents to write to the file @param [Hash] options a hash of options which may influence whether
the file should be saved or overwritten.
# File lib/parade/commands/render_from_template.rb, line 39 def create_file_with_contents(filename,contents,options) return if (File.exists?(filename) and not options.key?(:force)) File.open(filename,'w+') do |file| file.puts contents end true end
default_template_path()
click to toggle source
@return [String] the filepath to the templates directory within this project.
# File lib/parade/commands/render_from_template.rb, line 12 def default_template_path File.join File.dirname(__FILE__), "..", "..", "templates" end
default_view_path()
click to toggle source
@see HtmlOutput
@see StaticPdf
@return [String] the filepath to the views directory within this project
# File lib/parade/commands/render_from_template.rb, line 20 def default_view_path File.join File.dirname(__FILE__), "..", "..", "views" end
render_template(options)
click to toggle source
@param [Hash] options parameters that will help create the template
@return [String] the string contents from the rendered template.
# File lib/parade/commands/render_from_template.rb, line 28 def render_template(options) template = TemplateGenerator.new options template.render end