Class: Template
- Inherits:
-
Object
- Object
- Template
- Defined in:
- lib/rdoc/generator/template_loader.rb
Overview
Template allows to render HTML from a given hash with documentation and theme.
Instance Method Summary collapse
-
#initialize(path) ⇒ Template
constructor
A new instance of Template.
- #render(data) ⇒ Object
Constructor Details
#initialize(path) ⇒ Template
Returns a new instance of Template.
28 29 30 |
# File 'lib/rdoc/generator/template_loader.rb', line 28 def initialize(path) @path = path end |
Instance Method Details
#render(data) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rdoc/generator/template_loader.rb', line 32 def render(data) opts = { pretty: true } vars = RecursiveOpenStruct.new(data, recurse_over_arrays: true) template = Slim::Template.new(@path, opts) template.render(vars) end |