Skip to content

Instantly share code, notes, and snippets.

@oneamtu
Created March 2, 2013 18:04
Show Gist options
  • Save oneamtu/5072272 to your computer and use it in GitHub Desktop.
Save oneamtu/5072272 to your computer and use it in GitHub Desktop.
Eric's refactoring challenge
string.split('.').each_with_index.inject([""]){|a, i| a+[a[i[1]]+"."+i[0]]}.reject(&:empty?).map{|a| a[1..-1]}.join(" && ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment