Class: Cliqr::Usage::TemplateRenderer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cliqr/usage/usage_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Renders a template file based on configuration settings

Class Method Summary collapse

Class Method Details

.render(template_file_path, context) ⇒ Nothing

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Render a partial script

Returns:

  • (Nothing)


51
52
53
54
55
56
# File 'lib/cliqr/usage/usage_builder.rb', line 51

def self.render(template_file_path, context)
  template_file_path = File.expand_path(template_file_path, __FILE__)
  template = ERB.new(File.new(template_file_path).read, nil, '%')
  result = template.result(context.instance_eval { binding })
  Cliqr::Util.trim_newlines(result)
end