Class: Kojo::Template
- Inherits:
-
Object
- Object
- Kojo::Template
- Defined in:
- lib/kojo/template.rb
Overview
The Template class handles a single template file, and processes it for:
-
Variables (using %{var} syntax)
-
ERB
-
@import statements
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#import_base ⇒ Object
Returns the value of attribute import_base.
Instance Method Summary collapse
-
#initialize(file) ⇒ Template
constructor
A new instance of Template.
- #render(args = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
9 10 11 |
# File 'lib/kojo/template.rb', line 9 def args @args end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
9 10 11 |
# File 'lib/kojo/template.rb', line 9 def dir @dir end |
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
9 10 11 |
# File 'lib/kojo/template.rb', line 9 def extension @extension end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
9 10 11 |
# File 'lib/kojo/template.rb', line 9 def file @file end |
#import_base ⇒ Object
Returns the value of attribute import_base.
10 11 12 |
# File 'lib/kojo/template.rb', line 10 def import_base @import_base end |
Instance Method Details
#render(args = {}) ⇒ Object
19 20 21 22 |
# File 'lib/kojo/template.rb', line 19 def render(args = {}) @args = args evaluate file end |