summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-29 19:58:28 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-29 19:58:28 -0700
commitf7a4949ef5ba75348843ecc0564f284675c7be2e (patch)
treee5fed2e840549ce2f0907c13d51e9c5b7529199f /lib
parent96fd76f74b6eaa1620b321c8e55ce3c9675239f0 (diff)
downloadpsych-f7a4949ef5ba75348843ecc0564f284675c7be2e.zip
anonymous classes
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/ruby.rb2
-rw-r--r--lib/psych/visitors/yast_builder.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/psych/ruby.rb b/lib/psych/ruby.rb
index 97734f5..896c185 100644
--- a/lib/psych/ruby.rb
+++ b/lib/psych/ruby.rb
@@ -1,4 +1,4 @@
-[Object, String].each do |klass|
+[Object, String, Class].each do |klass|
klass.send(:remove_method, :to_yaml)
end
diff --git a/lib/psych/visitors/yast_builder.rb b/lib/psych/visitors/yast_builder.rb
index 65ed594..df6d390 100644
--- a/lib/psych/visitors/yast_builder.rb
+++ b/lib/psych/visitors/yast_builder.rb
@@ -23,6 +23,10 @@ module Psych
visitor_for(::String) do |o|
@stack.last.children << Nodes::Scalar.new(o)
end
+
+ visitor_for(::Class) do |o|
+ raise TypeError, "can't dump anonymous class #{o.class}"
+ end
end
end
end