# File lib/rubygame/rect.rb, line 385
        def clamp!(rect)
                nself = self.normalize
                rect = Rect.new_from_object(rect)
                #If self is inside given, there is no need to move self
                unless rect.contain?(nself)

                        #If self is too wide:
                        if nself.at(2) >= rect.at(2)
                                self[0] = rect.centerx - nself.at(2).div(2)
                                #Else self is not too wide
                        else
                                #If self is to the left of arg
                                if nself.at(0) < rect.at(0)
                                        self[0] = rect.at(0)
                                #If self is to the right of arg
                                elsif nself.right > rect.right
                                        self[0] = rect.right - nself.at(2)
                                #Otherwise, leave x alone
                                end
                        end

                        #If self is too tall:
                        if nself.at(3) >= rect.at(3)
                                self[1] = rect.centery - nself.at(3).div(2)
                                #Else self is not too tall
                        else
                                #If self is above arg
                                if nself.at(1) < rect.at(1)
                                        self[1] = rect.at(1)
                                #If self below arg
                                elsif nself.bottom > rect.bottom
                                        self[1] = rect.bottom - nself.at(3)
                                #Otherwise, leave y alone
                                end
                        end
                end
                return self
        end