Class: Nmap::Command::Port Private
- Inherits:
-
CommandMapper::Types::Num
- Object
- CommandMapper::Types::Num
- Nmap::Command::Port
- Defined in:
- lib/nmap/command.rb
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.
Direct Known Subclasses
Constant Summary collapse
- PORT_NUMBER_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.
/\d{1,5}/
- SERVICE_NAME_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.
/[A-Za-z0-9]+(?:[\/_-][A-Za-z0-9]+)*\*?/
- PORT_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.
/(?:#{PORT_NUMBER_REGEXP}|#{SERVICE_NAME_REGEXP})/
- 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.
/\A#{PORT_REGEXP}\z/
Instance Method Summary collapse
-
#format(value) ⇒ String
private
Formats the given value.
-
#initialize ⇒ Port
constructor
private
Initializes the port type.
-
#validate(value) ⇒ true, (false, String)
private
Validates the given value.
Constructor Details
#initialize ⇒ Port
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.
Initializes the port type.
204 205 206 |
# File 'lib/nmap/command.rb', line 204 def initialize super(range: 1..65535) end |
Instance Method Details
#format(value) ⇒ 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.
Formats the given value.
238 239 240 241 242 243 244 245 |
# File 'lib/nmap/command.rb', line 238 def format(value) case value when String value else super(value) end end |
#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 the given value.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/nmap/command.rb', line 215 def validate(value) case value when String case value when /\A#{PORT_NUMBER_REGEXP}\z/ super(value) when /\A#{SERVICE_NAME_REGEXP}\z/ return true else return [false, "must be a port number or service name (#{value.inspect})"] end else super(value) end end |