Class: Masscan::Command::MACAddress Private
- Inherits:
-
CommandMapper::Types::Str
- Object
- CommandMapper::Types::Str
- Masscan::Command::MACAddress
- Defined in:
- lib/masscan/command.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents the type for the --adapter-mac
and --router-mac
options.
Constant Summary collapse
- REGEXP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Regular expression to validate a MAC address.
/\A[A-Fa-f0-9]{2}(?::[A-Fa-f0-9]{2}){5}\z/
Instance Method Summary collapse
-
#validate(value) ⇒ true, (false, String)
private
Validates a MAC address value.
Instance Method Details
#validate(value) ⇒ true, (false, String)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validates a MAC address value.
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/masscan/command.rb', line 437 def validate(value) valid, = super(value) unless valid return [valid, ] end string = value.to_s unless string =~ REGEXP return [false, "invalid MAC address (#{value.inspect})"] end return true end |