Class: Grntest::TemplateEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/grntest/template-evaluator.rb

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ TemplateEvaluator

Returns a new instance of TemplateEvaluator.



18
19
20
# File 'lib/grntest/template-evaluator.rb', line 18

def initialize(template)
  @template = template
end

Instance Method Details

#evaluate(**local_variables) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/grntest/template-evaluator.rb', line 22

def evaluate(**local_variables)
  _binding = binding
  local_variables.each do |name, value|
    _binding.local_variable_set(name, value)
  end
  _binding.eval(@template)
end