summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-09 06:28:00 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-09 06:28:00 +0000
commitab714c82f0f9b8c27275f9dde3b56ff171ef37dc (patch)
tree3342a5757c8094d287e02843c043b64e846f42d1
parenteccb95543cd9cfa26daaeacd5c4e44672286948d (diff)
Add back my original example of Shellwords#shellescape.
* lib/shellwords.rb (Shellwords#shellescape): Add back my original real world example with some enhancement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/shellwords.rb9
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a3d1706543..1256fa9024 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
-Fri Nov 9 15:13:16 2012 Akinori MUSHA <knu@iDaemons.org>
+Fri Nov 9 15:25:42 2012 Akinori MUSHA <knu@iDaemons.org>
- * lib/shellwords.rb (Shellwords#shellescape): Undo part of the
+ * lib/shellwords.rb (Shellwords#shellescape): Add back my original
+ real world example with some enhancement.
+
+ * lib/shellwords.rb (Shellwords#shelljoin): Undo part of the
previous rdoc change. This new example using a string-only
array was not in line with the description.
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index fede2e1874..c3586d29fa 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -105,6 +105,15 @@ module Shellwords
# argv = "It's better to give than to receive".shellescape
# argv #=> "It\\'s\\ better\\ to\\ give\\ than\\ to\\ receive"
#
+ # # Search files in lib for method definitions
+ # pattern = "^[ \t]*def "
+ # open("| grep -Ern #{pattern.shellescape} lib") { |grep|
+ # grep.each_line { |line|
+ # file, lineno, matched_line = line.split(':', 3)
+ # # ...
+ # }
+ # }
+ #
# It is the caller's responsibility to encode the string in the right
# encoding for the shell environment where this string is used.
#