diff options
author | Markus Roberts <Markus@reality.com> | 2010-11-17 06:02:05 -0800 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-11-17 06:02:05 -0800 |
commit | ed49313c025131fa7a4697e834233a6e952ab6dd (patch) | |
tree | 0be0639a0e72d877152af9c4e4e194d8722da08c /lib/puppet/util/monkey_patches.rb | |
parent | 0d24ea3583c4cd6a4583f4788686a4f9e02cb994 (diff) | |
parent | 3c4412128a50e41380108e5a90f2656329b84492 (diff) | |
download | puppet-ed49313c025131fa7a4697e834233a6e952ab6dd.tar.gz puppet-ed49313c025131fa7a4697e834233a6e952ab6dd.tar.xz puppet-ed49313c025131fa7a4697e834233a6e952ab6dd.zip |
Merge branch 'ticket/next/4590' into next
Conflicts:
lib/puppet/util/monkey_patches.rb
-- two unrelated additions had been made, kept them both.
Diffstat (limited to 'lib/puppet/util/monkey_patches.rb')
-rw-r--r-- | lib/puppet/util/monkey_patches.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index bdce5ec1d..1c35ae523 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -48,6 +48,7 @@ if RUBY_VERSION == '1.8.7' end end + class Object # ActiveSupport 2.3.x mixes in a dangerous method # that can cause rspec to fork bomb @@ -56,3 +57,17 @@ class Object raise NotImplementedError, "Kernel.daemonize is too dangerous, please don't try to use it." end end + +# Workaround for yaml_initialize, which isn't supported before Ruby +# 1.8.3. +if RUBY_VERSION == '1.8.1' || RUBY_VERSION == '1.8.2' + YAML.add_ruby_type( /^object/ ) { |tag, val| + type, obj_class = YAML.read_type_class( tag, Object ) + r = YAML.object_maker( obj_class, val ) + if r.respond_to? :yaml_initialize + r.instance_eval { instance_variables.each { |name| remove_instance_variable name } } + r.yaml_initialize(tag, val) + end + r + } +end |