class Swat::Parameters

Parameters parsing helper class

Assumes the first parameter to be the execution mode (dryrun or execute) Assumes the second parameter to be the script name Captures the rest as arguments that are piped in to the script

Attributes

args[RW]
command[RW]
execution_mode[RW]

Public Class Methods

new(args = ARGV.clone) click to toggle source
# File lib/swat.rb, line 83
def initialize(args = ARGV.clone)
  @args = args
  @execution_mode = @args.shift
  @command = @args.shift
  fail "Execution mode is mandatory" if @execution_mode.nil?
  fail "No command was specified" if @command.nil?
end

Public Instance Methods

to_s() click to toggle source
# File lib/swat.rb, line 91
def to_s
  "#{@execution_mode} #{@command} #{@args.inspect}"
end