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

ruby-changes:40987

From: knu <ko1@a...>
Date: Sun, 13 Dec 2015 11:44:12 +0900 (JST)
Subject: [ruby-changes:40987] knu:r53066 (trunk): * lib/shellwords.rb: Turn on frozen-string-literal after fixing

knu	2015-12-13 11:43:56 +0900 (Sun, 13 Dec 2015)

  New Revision: 53066

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

  Log:
    * lib/shellwords.rb: Turn on frozen-string-literal after fixing
      shellsplit.

  Modified files:
    trunk/ChangeLog
    trunk/lib/shellwords.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53065)
+++ ChangeLog	(revision 53066)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec 13 11:38:12 2015  Akinori MUSHA  <knu@i...>
+
+	* lib/shellwords.rb: Turn on frozen-string-literal after fixing
+	  shellsplit.
+
 Sun Dec 13 10:44:44 2015  Martin Duerst  <duerst@i...>
 
 	* KNOWNBUGS.rb: Fixed typo, made more explicit [ci skip]
Index: lib/shellwords.rb
===================================================================
--- lib/shellwords.rb	(revision 53065)
+++ lib/shellwords.rb	(revision 53066)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/lib/shellwords.rb#L1
-# frozen-string-literal: false
+# frozen-string-literal: true
 ##
 # == Manipulates strings like the UNIX Bourne shell
 #
@@ -70,14 +70,14 @@ module Shellwords https://github.com/ruby/ruby/blob/trunk/lib/shellwords.rb#L70
   #   argv #=> ["here", "are", "two words"]
   def shellsplit(line)
     words = []
-    field = ''
+    field = String.new
     line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/m) do
       |word, sq, dq, esc, garbage, sep|
       raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage
       field << (word || sq || (dq || esc).gsub(/\\(.)/, '\\1'))
       if sep
         words << field
-        field = ''
+        field = String.new
       end
     end
     words

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

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