aboutsummaryrefslogtreecommitdiffstats
path: root/lib/yaml.rb
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-02 23:31:14 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-02 23:31:14 +0000
commit28b79f39570641caeea3b9464e0ac081580a91fe (patch)
treeadef687820d474cdfded3db8f888857b16a70b01 /lib/yaml.rb
parent6ebad07ea1c03d8b9b988d0f3be18ba37e1cb42b (diff)
downloadruby-28b79f39570641caeea3b9464e0ac081580a91fe.tar.gz
* ext/syck/lib/gram.c: allow root-level inline collections.
[ruby-talk:94922] * lib/yaml/rubytypes.rb (Symbol#to_yaml): emit symbols as implicits. [ruby-talk:94930] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml.rb')
-rw-r--r--lib/yaml.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/yaml.rb b/lib/yaml.rb
index 83ba9cc634..54880182e3 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -88,6 +88,17 @@ module YAML
end
#
+ # Dump documents to a stream
+ #
+ def YAML.dump_stream( *objs )
+ d = YAML::Stream.new
+ objs.each do |doc|
+ d.add( doc )
+ end
+ d.emit
+ end
+
+ #
# Add a transfer method to a domain
#
def YAML.add_domain_type( domain, type_re, &transfer_proc )
@@ -215,9 +226,14 @@ module Kernel
# ryan:: Either way, I certainly will have a pony parade.
#
- def y( x )
- puts x.to_yaml
+ def y( *x )
+ puts( if x.length == 1
+ YAML::dump( *x )
+ else
+ YAML::dump_stream( *x )
+ end )
end
+ private :y
end