From 7dc427f7ed18574470dea3c6c28c27d4134ec395 Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 7 Sep 2011 22:37:34 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ ext/syck/lib/syck/types.rb | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e96ed81b0..2349a3940c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Sep 8 07:36:36 2011 NARUSE, Yui + + * 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 * gc.c (id2ref): unmarked object is already dead while lazy diff --git a/ext/syck/lib/syck/types.rb b/ext/syck/lib/syck/types.rb index 5c129acba4..4a3fe873d9 100644 --- a/ext/syck/lib/syck/types.rb +++ b/ext/syck/lib/syck/types.rb @@ -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 ] )