Skip to content

Instantly share code, notes, and snippets.

@onpaws
Created February 20, 2013 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpaws/4999562 to your computer and use it in GitHub Desktop.
Save onpaws/4999562 to your computer and use it in GitHub Desktop.
Ruby .split() while keeping the key in the returned array. in this case the key is a period '.'
page.css('p').text.split(/(.)/).each_slice(2).map(&:join)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment