Class: Licensor::Template
- Inherits:
-
Object
- Object
- Licensor::Template
- Defined in:
- lib/licensor/template.rb
Constant Summary collapse
- EXTNAME =
".mustache"
Instance Attribute Summary collapse
-
#licenses ⇒ Object
readonly
Returns the value of attribute licenses.
Instance Method Summary collapse
-
#initialize ⇒ Template
constructor
A new instance of Template.
- #render(license, name, year) ⇒ Object
Constructor Details
Instance Attribute Details
#licenses ⇒ Object (readonly)
Returns the value of attribute licenses.
13 14 15 |
# File 'lib/licensor/template.rb', line 13 def licenses @licenses end |
Instance Method Details
#render(license, name, year) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/licensor/template.rb', line 15 def render(license, name, year) unless @licenses.include?(license) raise ArgumentError, "Given license `#{license}' is not supported. Try `--list' option to see all available licenses." end Mustache.render(File.read(@template_table[license]), name: name, year: year) end |