module Psych

Public Class Methods

safely_load(str) click to toggle source
# File lib/puppet/util/monkey_patches.rb, line 45
def Psych.safely_load(str)
  result = Psych.parse(str)
  if invalid_node = result.find { |node| node.tag =~ /!map:(.*)/ || node.tag =~ /!ruby\/hash:(.*)/ }
    raise ArgumentError, "Illegal YAML mapping found with tag #{invalid_node.tag}; please use !ruby/object:#{$1} instead"
  else
    result.to_ruby
  end
end