summaryrefslogtreecommitdiff
path: root/lib/psych/visitors/yaml_tree.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-02-28 18:10:39 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-02-28 18:10:39 -0800
commit960d30ef5ac4ab93db199852fcd93f3cc3dfe1dd (patch)
treec994e1379c146c60716d59fedd8db8f7f7342723 /lib/psych/visitors/yaml_tree.rb
parent5e6a486f3c0cde1529e47e4b74816284414762a4 (diff)
downloadpsych-960d30ef5ac4ab93db199852fcd93f3cc3dfe1dd.zip
* ext/psych/lib/psych/visitors/yaml_tree.rb: support dumping Encoding
objects. * ext/psych/lib/psych/visitors/to_ruby.rb: support loading Encoding objects. * test/psych/test_encoding.rb: add test * ext/psych/lib/psych.rb: add version
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 f89fcbb..ff0fcd2 100644
--- a/lib/psych/visitors/yaml_tree.rb
+++ b/lib/psych/visitors/yaml_tree.rb
@@ -157,6 +157,11 @@ module Psych
@emitter.end_sequence
end
+ def visit_Encoding o
+ tag = "!ruby/encoding"
+ @emitter.scalar o.name, nil, tag, false, false, Nodes::Scalar::ANY
+ end
+
def visit_Object o
tag = Psych.dump_tags[o.class]
unless tag