diff options
author | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-17 17:22:49 +0000 |
---|---|---|
committer | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-17 17:22:49 +0000 |
commit | f3d9f34537779e2ed3d29519c6a29346b74409d7 (patch) | |
tree | 4998dbfa7c8cab36cc089090e0c9e0e0bd28030f /lib/yaml | |
parent | 17f4f5f507715b8b832305f71b2375ca9f830ff4 (diff) | |
download | ruby-f3d9f34537779e2ed3d29519c6a29346b74409d7.tar.gz |
* lib/yaml/rubytypes.rb: remove comments that are bungling up
the rdoc and ri output. output symbols as plain scalars.
* ext/syck/rubyext.c (syck_emitter_reset): emit headless
documents always.
* ext/syck/emitter.c (syck_scan_scalar): quote scalars with any
kind of surrounding line space, tabs or spaces alike.
* ext/syck/token.c: accept tabs as whitespace, not for indentation,
but strip from plain scalars.
* test/yaml/test_yaml.rb: remove outdated tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml')
-rw-r--r-- | lib/yaml/rubytypes.rb | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index ca7529217e..29be1b96fc 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -1,9 +1,6 @@ # -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4 require 'date' -# -# Type conversions -# class Class def to_yaml( opts = {} ) raise TypeError, "can't dump anonymous class %s" % self.class @@ -25,9 +22,6 @@ class Object end end -# -# Maps: Hash#to_yaml -# class Hash yaml_as "tag:ruby.yaml.org,2002:hash" yaml_as "tag:yaml.org,2002:map" @@ -51,9 +45,6 @@ class Hash end end -# -# Structs: export as a !map -# class Struct yaml_as "tag:ruby.yaml.org,2002:struct" def self.yaml_tag_class_name; self.name.gsub( "Struct::", "" ); end @@ -108,9 +99,6 @@ class Struct end end -# -# Sequences: Array#to_yaml -# class Array yaml_as "tag:ruby.yaml.org,2002:array" yaml_as "tag:yaml.org,2002:seq" @@ -126,9 +114,6 @@ class Array end end -# -# Exception#to_yaml -# class Exception yaml_as "tag:ruby.yaml.org,2002:exception" def Exception.yaml_new( klass, tag, val ) @@ -150,10 +135,6 @@ class Exception end end - -# -# String#to_yaml -# class String yaml_as "tag:ruby.yaml.org,2002:string" yaml_as "tag:yaml.org,2002:str" @@ -194,9 +175,7 @@ class String end end end -# -# Symbol#to_yaml -# + class Symbol yaml_as "tag:ruby.yaml.org,2002:symbol" yaml_as "tag:ruby.yaml.org,2002:sym" @@ -210,15 +189,11 @@ class Symbol end def to_yaml( opts = {} ) YAML::quick_emit( nil, opts ) do |out| - out.scalar( taguri, self.id2name, :plain ) + out.scalar( "tag:yaml.org,2002:str", self.inspect, :plain ) end end end -# -# Range#to_yaml -# TODO: Rework the Range as a sequence (simpler) -# class Range yaml_as "tag:ruby.yaml.org,2002:range" def Range.yaml_new( klass, tag, val ) @@ -273,9 +248,6 @@ class Range end end -# -# Make an Regexp -# class Regexp yaml_as "tag:ruby.yaml.org,2002:regexp" def Regexp.yaml_new( klass, tag, val ) @@ -323,9 +295,6 @@ class Regexp end end -# -# Emit a Time object as an ISO 8601 timestamp -# class Time yaml_as "tag:ruby.yaml.org,2002:time" yaml_as "tag:yaml.org,2002:timestamp" @@ -373,9 +342,6 @@ class Time end end -# -# Emit a Date object as a simple implicit -# class Date yaml_as "tag:yaml.org,2002:timestamp#ymd" def to_yaml( opts = {} ) @@ -385,9 +351,6 @@ class Date end end -# -# Send Integer, Booleans, NilClass to String -# class Numeric def to_yaml( opts = {} ) YAML::quick_emit( nil, opts ) do |out| @@ -403,9 +366,11 @@ class Numeric end end end + class Fixnum yaml_as "tag:yaml.org,2002:int" end + class Float yaml_as "tag:yaml.org,2002:float" end |