Skip to content

Instantly share code, notes, and snippets.

@cored
Created April 3, 2013 21:24
Show Gist options
  • Save cored/5305461 to your computer and use it in GitHub Desktop.
Save cored/5305461 to your computer and use it in GitHub Desktop.
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