summaryrefslogtreecommitdiff
path: root/lib/shellwords.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/shellwords.rb')
-rw-r--r--lib/shellwords.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index ccc1c310607..d02d3b06d54 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