Ruby 4.1 リファレンスマニュアル

instance method Net::HTTP#port

port -> Integer[permalink][rdoc][edit]

接続するポート番号を返します。