-
-
Save graysky/115074 to your computer and use it in GitHub Desktop.
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
require 'sinatra' | |
class DatabaseStreamer | |
def initialize(blob) | |
@blob = blob | |
end | |
def each | |
while chunk = @blob.read(4096) | |
yield chunk | |
end | |
end | |
end | |
get '/iterative' do | |
blob = db.go_get_me_some_blob(...) | |
DatabaseStreamer.new(blob) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment