Skip to content

Instantly share code, notes, and snippets.

@graysky
Forked from rtomayko/iterativeapp.rb
Created May 20, 2009 20:34
Show Gist options
  • Save graysky/115074 to your computer and use it in GitHub Desktop.
Save graysky/115074 to your computer and use it in GitHub Desktop.
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