Skip to content

Instantly share code, notes, and snippets.

@daveworth
Created September 27, 2011 15:41
Show Gist options
  • Save daveworth/1245420 to your computer and use it in GitHub Desktop.
Save daveworth/1245420 to your computer and use it in GitHub Desktop.
begin
response.body.scan(/(.+?)(?:\n|$)/) do |line|
yield ActiveSupport::JSON.decode(line)
end
end
@alindeman
Copy link

Given String#lines, I think I'd go with:

response.body.lines do |line|
  yield ActiveSupport::JSON.decode(line)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment