[Rubyコードサンプル]URLをパースして必要な部分を取り出す
require 'uri'
image_path = "https://hogehoge.com/assets.xxx.jp/images/pictures/images/000/011/955/_DSC9720.jpg?1536823426"
# typeは1.9で廃止
# pp image_path.type
pp image_path.class
pp uri = URI.parse(image_path)
pp uri.scheme # https
pp uri.userinfo # nil
pp uri.host # hogehoge.com
pp uri.port # 443
pp uri.registry # nil
pp uri.path # /dev-xxx.jp/images/pictures/images/000/011/955/_DSC9720.jpg
pp uri.opaque # nil
pp uri.query # 1536823426
pp uri.fragment # nil