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.

Signed-off-by: Markus Roberts <[email protected]>
---
 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 b7f8a7b..c93d6ff 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)
-- 
1.6.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to