From 23d104a1611f4dd442b24980d37e8c344a529c56 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 8 Apr 2010 02:45:23 +0000 Subject: [PATCH] * lib/yaml.rb: use Psych if only it is loaded already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 +++- lib/yaml.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e3205c655..36ae9165aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ -Thu Apr 8 11:31:37 2010 Nobuyoshi Nakada +Thu Apr 8 11:45:14 2010 Nobuyoshi Nakada + + * lib/yaml.rb: use Psych if only it is loaded already. * lib/yaml.rb (YAML::EngineManager#yamler): set the result after successfully switched. diff --git a/lib/yaml.rb b/lib/yaml.rb index b1c6a70dde..9b5a9b2787 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -30,6 +30,8 @@ module YAML ENGINE = YAML::EngineManager.new end +engine = (!defined?(Syck) && defined?(Psych) ? 'psych' : 'syck') + module Syck ENGINE = YAML::ENGINE end @@ -38,4 +40,4 @@ module Psych ENGINE = YAML::ENGINE end -YAML::ENGINE.yamler = 'syck' +YAML::ENGINE.yamler = engine