問題 あるWebサイトをブックマークする際に、そのURLで表示されている画像の一覧から1つの画像を選択した上でブックマークしたいという要望を受け取ったとします。 そこで、画像選択用のサムネイル表示のために、URL上に表示されている画像URLの一覧を配列として提供したいのですが、どのようなメソッドで提供すべきでしょうか? ここでは、ごく簡単ではありますが正規表現を使って画像URL一覧の取得を行ってみます。 仕様 画像ファイルは「jpg, jpeg, gif, bmp, png」を取得する URIスキームが「http」の場合のみ画像を取得する 回答例 require 'open-uri' require 'resolv-replace' require 'timeout' class ImageUrl # 特定のURL上の画像パス一覧を取得する def self.get_image_urls(