Class: PVN::OptionNegativeMatch
- Inherits:
-
OptionMatch
- Object
- OptionMatch
- PVN::OptionNegativeMatch
- Defined in:
- lib/synoption/match.rb
Instance Method Summary collapse
-
#initialize(*negopts) ⇒ OptionNegativeMatch
constructor
A new instance of OptionNegativeMatch.
- #match?(arg) ⇒ Boolean
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
33 34 35 |
# File 'lib/synoption/match.rb', line 33 def match? arg arg && @negopts.select { |x| arg.index x }.size > 0 end |