The easiest way to kill it while it uses its flamethrower attack is to shoot the Teapot Cannon at its head before it begins the attack. This stops the ruin from attacking with the flamethrower, causing it to collapse with its final doll head exposed.