Class: KubernetesTemplateRendering::Template
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- KubernetesTemplateRendering::Template
- Defined in:
- lib/kubernetes_template_rendering/template.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#source_repo ⇒ Object
readonly
Returns the value of attribute source_repo.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
-
#variable_overrides ⇒ Object
readonly
Returns the value of attribute variable_overrides.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Class Method Summary collapse
-
.render(template_path, variables, erb_binding: nil, jsonnet_library_path: nil, source_repo: nil, variable_overrides: {}) ⇒ 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, source_repo: nil, variable_overrides: {}) ⇒ Template
constructor
A new instance of Template.
- #render(args) ⇒ Object
Constructor Details
#initialize(template_path, variables, source_repo: nil, variable_overrides: {}) ⇒ Template
Returns a new instance of Template.
13 14 15 16 17 18 |
# File 'lib/kubernetes_template_rendering/template.rb', line 13 def initialize(template_path, variables, source_repo: nil, variable_overrides: {}) @template_path = template_path @variables = variables.merge(variable_overrides) @source_repo = source_repo @variable_overrides = variable_overrides end |
Instance Attribute Details
#source_repo ⇒ Object (readonly)
Returns the value of attribute source_repo.
11 12 13 |
# File 'lib/kubernetes_template_rendering/template.rb', line 11 def source_repo @source_repo end |
#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 |
#variable_overrides ⇒ Object (readonly)
Returns the value of attribute variable_overrides.
11 12 13 |
# File 'lib/kubernetes_template_rendering/template.rb', line 11 def variable_overrides @variable_overrides 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, source_repo: nil, variable_overrides: {}) ⇒ 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.
65 66 67 |
# File 'lib/kubernetes_template_rendering/template.rb', line 65 def render(template_path, variables, erb_binding: nil, jsonnet_library_path: nil, source_repo: nil, variable_overrides: {}) new(template_path, variables, source_repo:, variable_overrides:).render(erb_binding: erb_binding, jsonnet_library_path: jsonnet_library_path) end |
Instance Method Details
#render(args) ⇒ Object
20 21 22 |
# File 'lib/kubernetes_template_rendering/template.rb', line 20 def render(args) raise "must be defined by subclass" end |