Class: Qddrud::ReadmeTemplate

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/qddrud/readme.rb

Overview

Constructs a new ERB object for rendering a Readme.md file.

Instance Method Summary collapse

Instance Method Details

#render(template) ⇒ Object

Desribe the behaviour of the method

Attributes

  • :template - The template to render against.

Examples

Assuming this is the content of template.erb:

My metadata is <%= metadata %>

You would render it with the following:

markdown = ReadmeTemplate.new(metadata: @metadata)
markdown.render(File.read('template.erb'))


20
21
22
# File 'lib/qddrud/readme.rb', line 20

def render(template)
  ERB.new(template).result(binding)
end