Created
September 25, 2013 12:49
-
-
Save chopmo/6699132 to your computer and use it in GitHub Desktop.
Terrible idea of the week
This file contains hidden or 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
module OmniMap | |
def method_missing(name, *args) | |
self.map { |e| e.send(name, *args) }.extend(OmniMap) | |
end | |
end | |
strings = ["**cleaning**", | |
"UP a 'few'", | |
" messy", | |
"stri..ngs "] | |
strings.extend(OmniMap) | |
strings.strip.gsub(/[^\w ]/, '').downcase.join(' ').capitalize # => "Cleaning up a few messy strings" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment