Created
November 7, 2011 23:01
-
-
Save samstokes/1346480 to your computer and use it in GitHub Desktop.
DG loop combinator thinking
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
# Hmmm | |
DG::loop_until { url.present? && chunks_done < 25 }.body do | |
make_http_request(stuff, things, other_things).safe_callback do |blah| | |
blah | |
end | |
end.transform | |
# Yum | |
DG::loop_until(lambda { url.present? && chunks_done < 25 }) do | |
make_http_request(stuff, things, other_things).safe_callback do |blah| | |
blah | |
end | |
end.transform | |
# Yuck | |
DG::loop.until(lambda { url.present? && chunks_done < 25 }) do | |
make_http_request(stuff, things, other_things).safe_callback do |blah| | |
blah | |
end | |
end.transform | |
# Yay | |
DG::loop do | |
make_http_request(stuff, things, other_things).safe_callback do |blah| | |
end | |
end.until { url.present? && chunks_done < 25 }.transform | |
# Whut | |
expect {|x| x }.to_raise BoomError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment