aboutsummaryrefslogtreecommitdiffstats
path: root/lib/yaml.rb
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-15 03:11:28 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-15 03:11:28 +0000
commitc474911e5b78749c5a85db39256240db5fb9e3be (patch)
treef333f1c306d07933ceb2f4098b8aefde5d34d29e /lib/yaml.rb
parent094290e68fd4dfed851e8f7254d60a1301fe97e2 (diff)
downloadruby-c474911e5b78749c5a85db39256240db5fb9e3be.tar.gz
* lib/yaml.rb: removed fallback to pure Ruby parser.
* lib/yaml/baseemitter.rb (node_text): rewriting folded scalars. * ext/syck/syck.h: reports style of scalars now, be they plain, block single-, or double-quoted. * ext/syck/syck.c: ditto. * ext/syck/gram.c: ditto. * ext/syck/node.c: ditto. * ext/syck/token.c: ditto. * ext/syck/rubyext.c (yaml_org_handler): symbols loaded only if scalar style is plain. * test/yaml/test_yaml.rb (test_perl_regexp): updated test to match new regexp serialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml.rb')
-rw-r--r--lib/yaml.rb35
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/yaml.rb b/lib/yaml.rb
index baa599d3c5..96fc64f48b 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -5,21 +5,12 @@
#
# Loads the parser/loader and emitter/writer.
#
-
module YAML
- begin
- require 'yaml/syck'
- @@parser = YAML::Syck::Parser
- @@loader = YAML::Syck::DefaultLoader
- @@emitter = YAML::Syck::Emitter
- rescue LoadError
- require 'yaml/parser'
- @@parser = YAML::Parser
- @@loader = YAML::DefaultLoader
- require 'yaml/emitter'
- @@emitter = YAML::Emitter
- end
+ require 'yaml/syck'
+ @@parser = YAML::Syck::Parser
+ @@loader = YAML::Syck::DefaultLoader
+ @@emitter = YAML::Syck::Emitter
require 'yaml/loader'
require 'yaml/stream'
@@ -148,7 +139,7 @@ module YAML
end
#
- # Method to extract colon-separated type and class, returning
+ # Method to extract colon-seperated type and class, returning
# the type and the constant of the class
#
def YAML.read_type_class( type, obj_class )
@@ -160,20 +151,12 @@ module YAML
#
# Allocate blank object
#
- def YAML.object_maker( obj_class, val, is_attr = false )
+ def YAML.object_maker( obj_class, val )
if Hash === val
- # name = obj_class.name
- # ostr = sprintf( "%c%co:%c%s\000", ::Marshal::MAJOR_VERSION, ::Marshal::MINOR_VERSION,
- # name.length + 5, name )
- # if is_attr
- # ostr[ -1, 1 ] = ::Marshal.dump( val ).sub( /^[^{]+\{/, '' )
- # end
o = obj_class.allocate
- unless is_attr
- val.each_pair { |k,v|
- o.instance_variable_set("@#{k}", v)
- }
- end
+ val.each_pair { |k,v|
+ o.instance_variable_set("@#{k}", v)
+ }
o
else
raise YAML::Error, "Invalid object explicitly tagged !ruby/Object: " + val.inspect