Updated Ruby Code with put pixel
added putpixel function