Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created December 21, 2016 07:54
Show Gist options
  • Save havenwood/e9c286c524f2de5649586e7d28fec7af to your computer and use it in GitHub Desktop.
Save havenwood/e9c286c524f2de5649586e7d28fec7af to your computer and use it in GitHub Desktop.
Just for fun, here's an alternate solution:
concatenated_size = 0
sentences.slice_when do |sentence|
concatenated_size += sentence.size
concatenated_size = 0 unless concatenated_size < 1500
end.map &:join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment