Adding Ruby implementation