Class: PVN::OptionNegativeMatch

Inherits:
OptionMatch show all
Defined in:
lib/synoption/match.rb

Instance Method Summary collapse

Constructor Details

#initialize(*negopts) ⇒ OptionNegativeMatch

Returns a new instance of OptionNegativeMatch.



28
29
30
31
# File 'lib/synoption/match.rb', line 28

def initialize *negopts
  # in case this gets passed an array as an element:
  @negopts = Array.new(negopts).flatten
end

Instance Method Details

#match?(arg) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/synoption/match.rb', line 33

def match? arg
  arg && @negopts.select { |x| arg.index x }.size > 0
end