Created
February 23, 2014 15:56
-
-
Save hiroshiro/9173148 to your computer and use it in GitHub Desktop.
URLのリンクにjpgのファイルがあればsave_file()メソッド使いファイルを保存する。save_extract_jpg() Rubyのメソッド。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # jpgがあればURLをセーブする。 | |
| ## | |
| def save_extract_jpg(doc) | |
| (doc/:img).each do |link| | |
| ->(url){ save_file(url) }.call(link[:src].to_s) if link[:src] =~ /.jpg/ | |
| end | |
| end | |
| save_extract_jpg(doc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment