mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
6ebad07ea1
commit
28b79f3957
4 changed files with 363 additions and 319 deletions
|
@ -1,3 +1,11 @@
|
|||
Sat Apr 3 08:28:47 2004 why the lucky stiff <why@ruby-lang.org>
|
||||
|
||||
* 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]
|
||||
|
||||
Fri Apr 2 19:28:48 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bcc32/Makefile.sub (OUTFLAG): needed for static-linked-ext.
|
||||
|
|
652
ext/syck/gram.c
652
ext/syck/gram.c
File diff suppressed because it is too large
Load diff
20
lib/yaml.rb
20
lib/yaml.rb
|
@ -87,6 +87,17 @@ module YAML
|
|||
return d
|
||||
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
|
||||
#
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ class Symbol
|
|||
end
|
||||
def to_yaml( opts = {} )
|
||||
YAML::quick_emit( nil, opts ) { |out|
|
||||
out << "!ruby/sym "
|
||||
out << ":"
|
||||
self.id2name.to_yaml( :Emitter => out )
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue