Class: KubernetesTemplateRendering::Template
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- KubernetesTemplateRendering::Template
- Defined in:
- lib/kubernetes_template_rendering/template.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Class Method Summary collapse
-
.render(template_path, variables, erb_binding: nil, jsonnet_library_path: nil) ⇒ Object
TODO The ErbTemplate and JsonnetTemplate classes both inherit from the Template class and implement a render method.
Instance Method Summary collapse
-
#initialize(template_path, variables) ⇒ Template
constructor
A new instance of Template.
- #render(args) ⇒ Object
Constructor Details
#initialize(template_path, variables) ⇒ Template
Returns a new instance of Template.
12 13 14 15 |
# File 'lib/kubernetes_template_rendering/template.rb', line 12 def initialize(template_path, variables) @template_path = template_path @variables = variables end |
Instance Attribute Details
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
11 12 13 |
# File 'lib/kubernetes_template_rendering/template.rb', line 11 def template_path @template_path end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
11 12 13 |
# File 'lib/kubernetes_template_rendering/template.rb', line 11 def variables @variables end |
Class Method Details
.render(template_path, variables, erb_binding: nil, jsonnet_library_path: nil) ⇒ Object
TODO The ErbTemplate and JsonnetTemplate classes both inherit from the Template class and implement a render method. However, the erb_binding parameter is used just in ErbTemplate, while the jsonnet_library_path parameter is used just in JsonnetTemplate. This is a little awkward. Potentially this could be refactored.
46 47 48 |
# File 'lib/kubernetes_template_rendering/template.rb', line 46 def render(template_path, variables, erb_binding: nil, jsonnet_library_path: nil) new(template_path, variables).render(erb_binding: erb_binding, jsonnet_library_path: jsonnet_library_path) end |
Instance Method Details
#render(args) ⇒ Object
17 18 19 |
# File 'lib/kubernetes_template_rendering/template.rb', line 17 def render(args) raise "must be defined by subclass" end |