Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DG loop combinator thinking
# 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
You can’t perform that action at this time.