summaryrefslogtreecommitdiff
path: root/lib/shellwords.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-03 23:23:24 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-03 23:23:24 +0000
commit6be866e2621c543b710da3ece25d32ce861ece02 (patch)
treed04460077cd11c4697a8135f5269203d1951b9ce /lib/shellwords.rb
parent983476fbab9a769532f38da5692e7c5e4390f1c7 (diff)
* lib/shellwords.rb: Update toplevel comment with an example. Patch
by Samnang Chhun. [Ruby 1.9 - Bug #5388] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/shellwords.rb')
-rw-r--r--lib/shellwords.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index f1300612bb..5d6ba7544e 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -1,7 +1,5 @@
-#
-# shellwords.rb: Manipulates strings a la UNIX Bourne shell
-#
-
+##
+# = Manipulates strings like the UNIX Bourne shell
#
# This module manipulates strings according to the word parsing rules
# of the UNIX Bourne shell.
@@ -9,13 +7,21 @@
# The shellwords() function was originally a port of shellwords.pl,
# but modified to conform to POSIX / SUSv3 (IEEE Std 1003.1-2001).
#
-# Authors:
-# - Wakou Aoyama
-# - Akinori MUSHA <knu@iDaemons.org>
+# == Example
#
-# Contact:
-# - Akinori MUSHA <knu@iDaemons.org> (current maintainer)
+# argv = Shellwords.split('here are "two words"') # or String#shellsplit
+# argv #=> ["here", "are", "two words"]
#
+# argv = Shellwords.escape("special's.txt") # or String#shellescape
+# system("cat " + argv)
+#
+# == Authors:
+# * Wakou Aoyama
+# * Akinori MUSHA <knu@iDaemons.org>
+#
+# == Contact:
+# * Akinori MUSHA <knu@iDaemons.org> (current maintainer)
+
module Shellwords
#
# Splits a string into an array of tokens in the same way the UNIX