Created
March 2, 2013 18:04
-
-
Save oneamtu/5072272 to your computer and use it in GitHub Desktop.
Eric's refactoring challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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