Skip to content

Instantly share code, notes, and snippets.

@chopmo
Created September 25, 2013 12:49
Show Gist options
  • Save chopmo/6699132 to your computer and use it in GitHub Desktop.
Save chopmo/6699132 to your computer and use it in GitHub Desktop.
Terrible idea of the week
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