From 17f705e8cd357158916481eb2a8f13e0f91f2299 Mon Sep 17 00:00:00 2001 From: why Date: Tue, 13 May 2003 22:29:52 +0000 Subject: * lib/yaml/rubytypes.rb, lib/yaml/types.rb: using Object#object_id rather than deprecated Object#id. * ext/token.c: changed ASCII escapes to octal notation. * ext/Setup*: added entries for static linking of Syck extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml/types.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/yaml/types.rb') diff --git a/lib/yaml/types.rb b/lib/yaml/types.rb index 7602c436e7..b34c38fe71 100644 --- a/lib/yaml/types.rb +++ b/lib/yaml/types.rb @@ -1,6 +1,10 @@ # # Classes required by the full core typeset # + +# Ruby 1.6.x Object#object_id +class Object; alias_method :object_id, :id; end unless Object.respond_to? :object_id + module YAML # @@ -12,7 +16,7 @@ module YAML @type_id = type; @value = val end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out << " !!#{@type_id}" value.to_yaml( :Emitter => out ) } @@ -35,7 +39,7 @@ module YAML "#{dom}/#{@type_id}" end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out << " !#{to_yaml_type} " value.to_yaml( :Emitter => out ) } @@ -95,7 +99,7 @@ module YAML true end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out.seq( "!omap" ) { |seq| self.each { |v| seq.add( Hash[ *v ] ) @@ -146,7 +150,7 @@ module YAML true end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out.seq( "!pairs" ) { |seq| self.each { |v| seq.add( Hash[ *v ] ) -- cgit v1.2.3