Created
October 4, 2012 07:03
-
-
Save samwgoldman/3831925 to your computer and use it in GitHub Desktop.
gary bernhardt 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
x = "some file name.with dots.html.markdown" | |
x.split(".").reverse.inject([x, []]) do |(file, exts), part| | |
if part =~ /\s/ || part == file | |
break [file, exts] | |
else | |
[file.chomp(".#{part}"), exts.push(part)] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment