summaryrefslogtreecommitdiff
path: root/lib/psych/visitors/yaml_tree.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/psych/visitors/yaml_tree.rb')
-rw-r--r--lib/psych/visitors/yaml_tree.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb
index de35c76..4019859 100644
--- a/lib/psych/visitors/yaml_tree.rb
+++ b/lib/psych/visitors/yaml_tree.rb
@@ -246,6 +246,11 @@ module Psych
end
end
+ def visit_Module o
+ raise TypeError, "can't dump anonymous module: #{o}" unless o.name
+ @emitter.scalar o.name, nil, '!ruby/module', false, false, Nodes::Scalar::SINGLE_QUOTED
+ end
+
def visit_Class o
raise TypeError, "can't dump anonymous class: #{o}" unless o.name
@emitter.scalar o.name, nil, '!ruby/class', false, false, Nodes::Scalar::SINGLE_QUOTED