Class: Bolt::PAL::YamlPlan::Step::Eval
Constant Summary
COMMON_STEP_KEYS, STEP_KEYS
Instance Attribute Summary
#body, #name, #target, #type
Class Method Summary
collapse
Instance Method Summary
collapse
create, #function_call, parse_code_string, step_error, validate, validate_puppet_code, validate_step_keys
Constructor Details
#initialize(step_body) ⇒ Eval
Returns a new instance of Eval.
16
17
18
19
|
# File 'lib/bolt/pal/yaml_plan/step/eval.rb', line 16
def initialize(step_body)
super
@eval = step_body['eval']
end
|
Class Method Details
.allowed_keys ⇒ Object
8
9
10
|
# File 'lib/bolt/pal/yaml_plan/step/eval.rb', line 8
def self.allowed_keys
super + Set['eval']
end
|
.required_keys ⇒ Object
12
13
14
|
# File 'lib/bolt/pal/yaml_plan/step/eval.rb', line 12
def self.required_keys
Set.new
end
|
Instance Method Details
#transpile ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bolt/pal/yaml_plan/step/eval.rb', line 21
def transpile
code = String.new(" ")
code << "$#{@name} = " if @name
code_body = Bolt::Util.to_code(@eval)
if @name && code_body.lines.count > 1
indented = code_body.gsub(/\n/, "\n ").chomp(" ")
code << "with() || {\n #{indented}}"
else
code << code_body
end
code << "\n"
end
|