Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
a = %w(a b c d)
a.inject([]) {|arr,e| arr[-1]=='a' ? arr.insert(-2,e) : arr.push(e)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.