class Greyatom::OptionsSanitizer

Constants

KNOWN_COMMANDS

Attributes

args[R]

Public Class Methods

new(args) click to toggle source
# File lib/greyatom/options-sanitizer.rb, line 18
def initialize(args)
  @args = args
end

Public Instance Methods

sanitize!() click to toggle source
# File lib/greyatom/options-sanitizer.rb, line 22
def sanitize!
  sanitizeTestArgs!
end

Private Instance Methods

exitWithCannotUnderstand() click to toggle source
# File lib/greyatom/options-sanitizer.rb, line 39
def exitWithCannotUnderstand
  puts "Sorry, I can't understand what you're trying to do. Type `greyatom help` for help."
  exit
end
missingOrUnknownArgs?() click to toggle source

Arg check methods

# File lib/greyatom/options-sanitizer.rb, line 35
def missingOrUnknownArgs?
  args.empty? || !KNOWN_COMMANDS.include?(args[0])
end
sanitizeTestArgs!() click to toggle source
# File lib/greyatom/options-sanitizer.rb, line 28
def sanitizeTestArgs!
  if missingOrUnknownArgs?
    exitWithCannotUnderstand
  end
end