diff options
author | Markus Roberts <Markus@reality.com> | 2010-03-25 15:54:33 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 33b565a0d76b07f354e2e145e7e03e5a5db69e48 (patch) | |
tree | 934f60c39eb6f4a9cf9c468552bbaea2cd8787f6 /lib | |
parent | 4820a1b569444f942b3ceb6ee3a0832ed6faf613 (diff) | |
download | puppet-33b565a0d76b07f354e2e145e7e03e5a5db69e48.tar.gz puppet-33b565a0d76b07f354e2e145e7e03e5a5db69e48.tar.xz puppet-33b565a0d76b07f354e2e145e7e03e5a5db69e48.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.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 05d319356..53ae1b9c0 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -20,11 +20,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) |