summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/visitors/yaml_tree.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/lib/psych/visitors/yaml_tree.rb')
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index de35c7678b..40198599bf 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/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