lib/bolt/pal/yaml_plan/step/eval.rb
# Transpiles the step into the plan language
#
Transpiles the step into the plan language
Transpiles the step into the plan language
def transpile
            code = String.new("  ")
            code << "$#{body['name']} = " if body['name']
            code_body = Bolt::Util.to_code(body['eval']) || 'undef'
            if body['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
def transpile code = String . new ( "  " ) code << "$#{body['name']} = " if body [ 'name' ] code_body = Bolt :: Util . to_code ( body [ 'eval' ] ) || 'undef' if body [ '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
Transpiles the step into the plan language
Transpiles the step into the plan language
# If we're trying to assign the result of a multi-line eval to a name # variable, we need to wrap it in `with()`.