1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix an example of Shellwords#shellescape.

* lib/shellwords.rb (Shellwords#shellescape): Undo part of the
  previous rdoc change.  This new example using a string-only
  array was not in line with the description.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2012-11-09 06:25:02 +00:00
parent dfb44feefe
commit eccb95543c
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Fri Nov 9 15:13:16 2012 Akinori MUSHA <knu@iDaemons.org>
* lib/shellwords.rb (Shellwords#shellescape): Undo part of the
previous rdoc change. This new example using a string-only
array was not in line with the description.
Fri Nov 9 12:58:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_str_crypt): crypt(3) may return NULL.

View file

@ -155,9 +155,7 @@ module Shellwords
#
# You can also mix non-string objects in the elements as allowed in Array#join.
#
# ary = ["All", "work", "and", "no", "play", "makes", $0, "a", "dull", "boy"]
# argv = ary.shelljoin
# argv #=> "All work and no play makes irb a dull boy"
# output = `#{['ps', '-p', $$].shelljoin}`
#
def shelljoin(array)
array.map { |arg| shellescape(arg) }.join(' ')