1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/syck/lib/syck/types.rb: use toplevel Syck.

for the case someone define Syck::Syck (or YAML::Syck).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-09-07 22:37:34 +00:00
parent 4fe51cb330
commit 7dc427f7ed
2 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,8 @@
Thu Sep 8 07:36:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/syck/lib/syck/types.rb: use toplevel Syck.
for the case someone define Syck::Syck (or YAML::Syck).
Thu Sep 8 07:33:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (id2ref): unmarked object is already dead while lazy

View file

@ -45,7 +45,7 @@ module Syck
class Object
def self.tag_subclasses?; false; end
def to_yaml( opts = {} )
Syck.quick_emit( self, opts ) do |out|
::Syck.quick_emit( self, opts ) do |out|
out.map( "tag:ruby.yaml.org,2002:object:#{ @class }", to_yaml_style ) do |map|
@ivars.each do |k,v|
map.add( k, v )
@ -67,7 +67,7 @@ module Syck
self.default.to_s
end
def update( h )
if Syck::SpecialHash === h
if ::Syck::SpecialHash === h
@default = h.default if h.default
end
super( h )
@ -89,11 +89,11 @@ module Syck
if Hash === v
concat( v.to_a ) # Convert the map to a sequence
else
raise Syck::Error, "Invalid !omap entry: " + val.inspect
raise ::Syck::Error, "Invalid !omap entry: " + val.inspect
end
end
else
raise Syck::Error, "Invalid !omap: " + val.inspect
raise ::Syck::Error, "Invalid !omap: " + val.inspect
end
self
end
@ -123,7 +123,7 @@ module Syck
true
end
def to_yaml( opts = {} )
Syck.quick_emit( self, opts ) do |out|
::Syck.quick_emit( self, opts ) do |out|
out.seq( taguri, to_yaml_style ) do |seq|
self.each do |v|
seq.add( Hash[ *v ] )
@ -144,11 +144,11 @@ module Syck
if Hash === v
concat( v.to_a ) # Convert the map to a sequence
else
raise Syck::Error, "Invalid !pairs entry: " + val.inspect
raise ::Syck::Error, "Invalid !pairs entry: " + val.inspect
end
end
else
raise Syck::Error, "Invalid !pairs: " + val.inspect
raise ::Syck::Error, "Invalid !pairs: " + val.inspect
end
self
end
@ -173,7 +173,7 @@ module Syck
true
end
def to_yaml( opts = {} )
Syck.quick_emit( self, opts ) do |out|
::Syck.quick_emit( self, opts ) do |out|
out.seq( taguri, to_yaml_style ) do |seq|
self.each do |v|
seq.add( Hash[ *v ] )