Module: Lbrt::Utils::TemplateHelper
- Included in:
- Alert::DSL::Context, Alert::DSL::Context::Alert, Alert::DSL::Context::Alert::Condition, Service::DSL::Context, Service::DSL::Context::Service, Space::DSL::Context, Space::DSL::Context::Space, Space::DSL::Context::Space::Chart, Space::DSL::Context::Space::Chart::Stream
- Defined in:
- lib/lbrt/utils.rb
Instance Method Summary collapse
Instance Method Details
#include_template(template_name, context = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/lbrt/utils.rb', line 43 def include_template(template_name, context = {}) tmplt = @context.templates[template_name.to_s] unless tmplt raise "Template `#{template_name}` is not defined" end context_orig = @context @context = @context.merge(context) instance_eval(&tmplt) @context = context_orig end |