[前][次][番号順一覧][スレッド一覧]

ruby-changes:28464

From: eregon <ko1@a...>
Date: Mon, 29 Apr 2013 00:41:03 +0900 (JST)
Subject: [ruby-changes:28464] eregon:r40516 (trunk): * lib/yaml.rb: Clarify documentation about YAML being always Psych.

eregon	2013-04-29 00:40:53 +0900 (Mon, 29 Apr 2013)

  New Revision: 40516

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40516

  Log:
    * lib/yaml.rb: Clarify documentation about YAML being always Psych.
      Give a tip about using Syck. See #8344.

  Modified files:
    trunk/ChangeLog
    trunk/lib/yaml.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40515)
+++ ChangeLog	(revision 40516)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Apr 29 00:40:13 2013  Benoit Daloze  <eregontp@g...>
+
+	* lib/yaml.rb: Clarify documentation about YAML being always Psych.
+	  Give a tip about using Syck. See #8344.
+
 Sun Apr 28 23:34:01 2013  Benoit Daloze  <eregontp@g...>
 
 	* lib/yaml.rb: Use another trick to define the YAML module.
Index: lib/yaml.rb
===================================================================
--- lib/yaml.rb	(revision 40515)
+++ lib/yaml.rb	(revision 40516)
@@ -1,7 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L1
 ##
-# The YAML module allows you to use one of the two YAML engines that ship with
-# ruby.  By default Psych is used but the old and unmaintained Syck may be
-# chosen.
+# The YAML module is an alias of Psych, the YAML engine for ruby.
 
 begin
   require 'psych'
@@ -15,13 +13,9 @@ end https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L13
 YAML = Psych
 
 module Psych # :nodoc:
+  # For compatibility, deprecated
   class EngineManager
-    # Returns the YAML engine in use.
-    #
-    # By default Psych is used but the old and unmaintained Syck may be chosen.
-    #
-    # See #yamler= for more information.
-    attr_reader :yamler
+    attr_reader :yamler # :nodoc:
 
     def initialize # :nodoc:
       @yamler = 'psych'
@@ -31,18 +25,15 @@ module Psych # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L25
       false
     end
 
-    # By default Psych is used but the old and unmaintained Syck may be chosen.
-    #
-    # After installing the 'syck' gem, you can set the YAML engine to syck:
-    #
-    #   YAML::ENGINE.yamler = 'syck'
+    # Psych is now always used and this method has no effect.
     #
-    # To set the YAML engine back to psych:
+    # This method is still present for compatibility.
     #
-    #   YAML::ENGINE.yamler = 'psych'
+    # You may still use the Syck engine by installing
+    # the 'syck' gem and using the Syck constant.
     def yamler= engine
       case engine
-      when 'syck' then warn "syck has been removed"
+      when 'syck' then warn "syck has been removed, psych is used instead"
       when 'psych' then @yamler = 'psych'
       else
         raise(ArgumentError, "bad engine")
@@ -59,11 +50,9 @@ end https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L50
 #
 # This module provides a Ruby interface for data serialization in YAML format.
 #
-# The underlying implementation depends on an engine to handle the parsing and
-# serialization for Ruby, by default this will be using the libyaml wrapper
-# Psych.
+# The underlying implementation is now always the libyaml wrapper Psych.
 #
-# See Psych::EngineManager for details on switching the default YAML engine.
+# See Psych::EngineManager#yamler= for details on using Syck.
 #
 # Working with YAML can be very simple, for example:
 #
@@ -80,6 +69,6 @@ end https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L69
 # doc/security.rdoc for more information.
 #
 # For more advanced details on the implementation see Psych, and also check out
-# yaml.org for spec details and other helpful information.
+# http://yaml.org for spec details and other helpful information.
 module YAML
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]