Escaping URI strings the Ruby way.
You could say: URI.encode(’hello world’) # hello%20world But that’s ugly, so why not: ‘hello world’.encode # hello%20world Much nicer and more rubyesque! Here’s one way to do it: require ‘uri’ class String def encode URI.encode(self) end def decode URI.decode(self) end end Why do you use decode and encode instead of escape [...]