summaryrefslogtreecommitdiffstats
path: root/lib/yaml
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
commit6b3533ed4c70cdd11bd8f19234cf29e8eb84343a (patch)
tree12050e433bfd36426d980361151ced0b65041be4 /lib/yaml
parent286e957c3b0aa72ad2ce6df2f6ab03acb051d530 (diff)
downloadruby-6b3533ed4c70cdd11bd8f19234cf29e8eb84343a.tar.gz
ruby-6b3533ed4c70cdd11bd8f19234cf29e8eb84343a.tar.xz
ruby-6b3533ed4c70cdd11bd8f19234cf29e8eb84343a.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@9816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml')
-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 d58e9bb38..eebf02713 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 = {} )