summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-03-25 15:54:33 -0700
committerMarkus Roberts <Markus@reality.com>2010-03-25 16:25:24 -0700
commit2defc009f0403953a8ebcdb5f34b459921428eb2 (patch)
treecd8c9ad4ee442a5b66f15b3f41f22b3aefb4008a /lib
parent44798b90c2225dcb4919dbd9d8debf2ecb651864 (diff)
downloadpuppet-2defc009f0403953a8ebcdb5f34b459921428eb2.tar.gz
puppet-2defc009f0403953a8ebcdb5f34b459921428eb2.tar.xz
puppet-2defc009f0403953a8ebcdb5f34b459921428eb2.zip
Fix for #3424 and tests to prove it.
The original pure ruby yaml patch missed some edge cases; specifically, classes that were modified by the syck version to directly call it and thus never reached the pure ruby version. This adds monkey patches to all of those case which we might reasonably care about (omitting, for example, calls within the syck version to itself) and tests which show that the monkey patch works.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util/monkey_patches.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
index b7f8a7b68..c93d6ffb9 100644
--- a/lib/puppet/util/monkey_patches.rb
+++ b/lib/puppet/util/monkey_patches.rb
@@ -19,11 +19,13 @@ class Symbol
end
end
-class Object
- def to_yaml
- ZAML.dump(self)
+[Object, Exception, Integer, Struct, Date, Time, Range, Regexp, Hash, Array, Float, String, FalseClass, TrueClass, Symbol, NilClass, Class].each { |cls|
+ cls.class_eval do
+ def to_yaml
+ ZAML.dump(self)
+ end
end
-end
+}
def YAML.dump(*args)
ZAML.dump(*args)