Class: Nmap::Command::Time Private
- Inherits:
-
CommandMapper::Types::Str
- Object
- CommandMapper::Types::Str
- Nmap::Command::Time
- Defined in:
- lib/nmap/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 a unit of time.
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 for validating a unit of time.
/\A\d+(?:h|m|s|ms)?\z/
Instance Method Summary collapse
-
#validate(value) ⇒ true, (false, String)
private
Validates a time 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 time value.
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/nmap/command.rb', line 457 def validate(value) case value when Integer then true else valid, = super(value) unless valid return [valid, ] end value = value.to_s unless value =~ REGEXP return [false, "must be a number and end with 'ms', 's', 'm', or 'h'"] end return true end end |