Last active
August 29, 2015 14:11
-
-
Save abonec/836dfe35241b03b1dacf to your computer and use it in GitHub Desktop.
This file contains 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
def iterate_over_pages pattern | |
page = 1 | |
loop do | |
url = pattern.gsub(/%page%/, page.to_s) | |
break unless yield url, page | |
page += 1 | |
end | |
end | |
iterate_over_pages("http://leplay.com.ua/category/pic/page/%page%/") do |url, page| | |
puts url | |
4.times do |i| | |
puts i | |
if page == 3 && i == 3 | |
break | |
end | |
end | |
end |
psylone
commented
Dec 15, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment