Class: Bolt::PAL::YamlPlan::DoubleQuotedString

Inherits:
EvaluableString show all
Defined in:
lib/bolt/pal/yaml_plan.rb

Overview

This class represents a double-quoted YAML string, which is interpreted as though it were a double-quoted Puppet string (with associated variable interpolations)

Instance Attribute Summary

Attributes inherited from EvaluableString

#file, #line, #value

Instance Method Summary collapse

Methods inherited from EvaluableString

#==, #initialize

Constructor Details

This class inherits a constructor from Bolt::PAL::YamlPlan::EvaluableString

Instance Method Details

#evaluate(scope, evaluator) ⇒ Object


130
131
132
133
134
135
136
137
138
139
# File 'lib/bolt/pal/yaml_plan.rb', line 130

def evaluate(scope, evaluator)
  # "inspect" allows us to get back a double-quoted string literal with
  # special characters escaped. This is based on the assumption that
  # YAML, Ruby and Puppet all support similar escape sequences.
  parse_result = evaluator.parse_string(@value.inspect)

  scope.with_local_scope({}) do
    evaluator.evaluate(scope, parse_result)
  end
end