Class: Gmortar::Template
- Inherits:
-
Object
- Object
- Gmortar::Template
- Defined in:
- lib/gmortar/template.rb
Instance Method Summary collapse
-
#initialize(name) ⇒ Template
constructor
A new instance of Template.
- #result ⇒ Object
- #set(key, value) ⇒ Object
Constructor Details
#initialize(name) ⇒ Template
Returns a new instance of Template.
3 4 5 6 7 8 9 |
# File 'lib/gmortar/template.rb', line 3 def initialize(name) path = File.( File.join(__dir__, "..","..", "templates", name) ) @__erb = ERB.new File.read(path) end |
Instance Method Details
#result ⇒ Object
15 16 17 |
# File 'lib/gmortar/template.rb', line 15 def result @__erb.result binding end |
#set(key, value) ⇒ Object
11 12 13 |
# File 'lib/gmortar/template.rb', line 11 def set(key, value) instance_variable_set "@#{key}", value end |