summaryrefslogtreecommitdiff
path: root/lib/yaml/rubytypes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yaml/rubytypes.rb')
-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 = {} )