Ruby hash built in support for Murmur3 hashing. If you are commited to md5 hashes then using this will not work. If you can use it, then just call the .hash method from the Object class ( http://ruby-doc.org/core-2.1.1/Object.html#method-i-hash ).
pry(main)> {}.hash
=> 0
pry(main)> {:a => "b"}.hash
=> 2051585302280555993
pry(main)> "foo".hash
=> -2886254516463342771
Murmur3 hashes are faster then md5, but may not be suitable for cryptographic uses. If you must use MD5 I see no reason why hashing a string is fundamentally bad. It may even ease to recreating the same hash in languages other than Ruby if required, because it separates the implementation from Ruby's internal binary format.
If you must use a cryptographic hash but are not committed to MD5, please use BCrypt, SHA1 or SHA256. MD5 is trivially reversible and not suitable for securing data.
edit: details and grammar