summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/shellwords.rb6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 53d9340ea3..43074d25e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Dec 13 11:38:12 2015 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb: Turn on frozen-string-literal after fixing
+ shellsplit.
+
Sun Dec 13 10:44:44 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
* KNOWNBUGS.rb: Fixed typo, made more explicit [ci skip]
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index ccc1c31060..d02d3b06d5 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -1,4 +1,4 @@
-# frozen-string-literal: false
+# frozen-string-literal: true
##
# == Manipulates strings like the UNIX Bourne shell
#
@@ -70,14 +70,14 @@ module Shellwords
# 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