summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-10 03:50:28 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-10 03:50:28 +0000
commit7e0fd1eccaf9a02880ec0c69dfbdb8139e8bb3ff (patch)
treed0d8a0fb6c525be35faa76114a21d5b4b67c0886 /lib
parent9ee62cee66b809df22f3d8cbdaae1668fc34c82f (diff)
* lib/yaml/rubytypes.rb (Fixnum): Bignum could not be loaded in
ruby 1.8.3/1.8.4. [ruby-core:6115] * lib/yaml/rubytypes.rb (Numeric): Subclass of Numeric could not be dumped properly. [ruby-core:7047] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/yaml/rubytypes.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb
index d58e9bb38e..eebf027135 100644
--- a/lib/yaml/rubytypes.rb
+++ b/lib/yaml/rubytypes.rb
@@ -353,7 +353,17 @@ class Date
end
end
-class Numeric
+class Integer
+ yaml_as "tag:yaml.org,2002:int"
+ def to_yaml( opts = {} )
+ YAML::quick_emit( nil, opts ) do |out|
+ out.scalar( "tag:yaml.org,2002:int", self.to_s, :plain )
+ end
+ end
+end
+
+class Float
+ yaml_as "tag:yaml.org,2002:float"
def to_yaml( opts = {} )
YAML::quick_emit( nil, opts ) do |out|
str = self.to_s
@@ -364,19 +374,11 @@ class Numeric
elsif str == "NaN"
str = ".NaN"
end
- out.scalar( taguri, str, :plain )
+ out.scalar( "tag:yaml.org,2002:float", str, :plain )
end
end
end
-class Fixnum
- yaml_as "tag:yaml.org,2002:int"
-end
-
-class Float
- yaml_as "tag:yaml.org,2002:float"
-end
-
class TrueClass
yaml_as "tag:yaml.org,2002:bool#yes"
def to_yaml( opts = {} )