Class: Fuelcell::Parser::IgnoreHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/fuelcell/parser/ignore_handler.rb

Overview

Removes any args after the string ‘–’ is found in the raw_args. It also removes the ignore string itself from the raw args.

Returns:

  • (Array)

Instance Method Summary collapse

Instance Method Details

#call(raw_args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fuelcell/parser/ignore_handler.rb', line 9

def call(raw_args)
  unless raw_args.is_a?(Array)
    fail ArgumentError, 'raw args must be an array'
  end

  ignores = []
  index   = raw_args.index('--')
  return ignores unless index

  ignores = raw_args.slice!(index, raw_args.size)
  # remove the ignore symbol --
  ignores.shift
  ignores
end