Ruby version of paste.py