Sha256: a02c6f519bd83d4bc7f3aaf19596eb82d003dabadf3d608be39f641f61cb4733

Contents?: true

Size: 789 Bytes

Versions: 13

Compression:

Stored size: 789 Bytes

Contents

# TITLE:
#
#   Shellwords Extended
#
# DESCRIPTION:
#
#   Adds extensions to Shellwords, namely #escape.
#
# COPYRIGHT:
#
#   Copyright (c) 2007 Thomas Sawyer
#
# LICENSE:
#
#   Ruby License
#
#   This module is free software. You may use, modify, and/or redistribute this
#   software under the same terms as Ruby.
#
#   This program is distributed in the hope that it will be useful, but WITHOUT
#   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#   FOR A PARTICULAR PURPOSE.
#
# AUTHORS:
#
#   - Thomas Sawuer


require 'shellwords'


module Shellwords

  module_function

  # Escape special characters used in most
  # unix shells to use it, eg. with system().

  def escape(cmdline)
    cmdline.gsub(/([\\\t\| &`<>)('"])/) { |s| '\\' << s }
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
facets-2.0.0 lib/more/facets/shellwords.rb
facets-2.0.1 lib/more/facets/shellwords.rb
facets-2.0.2 lib/more/facets/shellwords.rb
facets-2.0.3 lib/more/facets/shellwords.rb
facets-2.0.4 lib/more/facets/shellwords.rb
facets-2.0.5 lib/more/facets/shellwords.rb
facets-2.1.0 lib/more/facets/shellwords.rb
facets-2.1.1 lib/more/facets/shellwords.rb
facets-2.1.2 lib/more/facets/shellwords.rb
facets-2.1.3 lib/more/facets/shellwords.rb
facets-2.2.0 lib/more/facets/shellwords.rb
facets-2.2.1 lib/more/facets/shellwords.rb
facets-2.3.0 lib/more/facets/shellwords.rb