Created
April 3, 2013 21:24
-
-
Save cored/5305461 to your computer and use it in GitHub Desktop.
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
module TM | |
module StringExtensions | |
def to_hash | |
return '' if self.nil? | |
self.split(/,/).inject({}) do |hash, kv| | |
arg, val = kv.split(/:/) | |
hash[arg.to_sym] = val | |
hash | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment