Class: Ronin::CLI::Commands::Quote Private

Inherits:
StringMethodsCommand show all
Defined in:
lib/ronin/cli/commands/quote.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Produces quoted a string for a variety of programming languages.

Usage

ronin quote [options] [FILE ...]

Options

-f, --file FILE                  Optional file to process
    --string STRING              Optional string to process
-M, --multiline                  Process each line separately
-n, --keep-newlines              Preserves newlines at the end of each line
-X, --hex                        Quotes the data as a Hex string
-c, --c                          Quotes the data as a C string
-j, --js                         JavaScript quotes the data
-S, --shell                      Quotes the data as a Shell String
-P, --powershell                 Quotes the data as a PowerShell String
-R, --ruby                       Quotes the data as a Ruby String
-h, --help                       Print help information

Arguments

[FILE ...]                       Optional file(s) to process

Since:

  • 2.0.0

Instance Attribute Summary

Attributes included from MethodOptions

#method_calls

Attributes inherited from StringProcessorCommand

#input_values

Instance Method Summary collapse

Methods included from MethodOptions

#apply_method_options, #initialize

Methods inherited from StringProcessorCommand

#initialize, #print_string, #process_input, #run

Methods inherited from FileProcessorCommand

#open_file, #process_file, #process_input, #run

Instance Method Details

#process_string(string) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

If no options are given, then --string is assumed.

Quotes the String.

Parameters:

  • string (String)

    The String to quote.

Returns:

  • (String)

    The quoted String.

Since:

  • 2.0.0



103
104
105
106
107
108
109
# File 'lib/ronin/cli/commands/quote.rb', line 103

def process_string(string)
  if @method_calls.empty?
    string.inspect
  else
    super(string)
  end
end