snapshot of htgt's ruby lib