class Wpxf::PortOption

A network port option.

Public Instance Methods

normalize(value) click to toggle source

@param value the value to normalize. @return [Integer] a normalized value to conform with the type that

the option is conveying.
# File lib/wpxf/core/opts/port_option.rb, line 10
def normalize(value)
  value.to_i
end
valid?(value) click to toggle source

Check if the specified value is valid in the context of this option. @param value the value to validate. @return [Boolean] true if valid.

Calls superclass method Wpxf::Option#valid?
# File lib/wpxf/core/opts/port_option.rb, line 17
def valid?(value)
  if value.to_s.match(/^\d+$/).nil? || (value.to_i.negative? || value.to_i > 65_535)
    return false
  end

  super
end