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

#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



115
116
117
118
119
120
121
122
123
124
# File 'lib/bolt/pal/yaml_plan.rb', line 115

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