Added Ruby implementation