diff options
author | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-13 22:29:52 +0000 |
---|---|---|
committer | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-13 22:29:52 +0000 |
commit | 17f705e8cd357158916481eb2a8f13e0f91f2299 (patch) | |
tree | f87da2401d58b41316f250d4e2065a257b12d190 /lib/yaml/types.rb | |
parent | bee670e33a3b42cd6783ef40e7a6e3ee2cd41c6b (diff) |
* 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
Diffstat (limited to 'lib/yaml/types.rb')
-rw-r--r-- | lib/yaml/types.rb | 12 |
1 files changed, 8 insertions, 4 deletions
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 ] ) |