class Bundler::URI::Generic

def check_port(v)


with a port component defined.
Can not have a registry or opaque component defined,

and against the Bundler::URI::Parser Regexp for :PORT.
Checks the port +v+ component for RFC2396 compliance
def check_port(v)
  return v unless v
  if @opaque
    raise InvalidURIError,
      "can not set port with registry or opaque"
  elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
    raise InvalidComponentError,
      "bad component(expected port component): #{v.inspect}"
  end
  return true
end