Gender Checking

Okay, I am a super SUPER noob, and I need help getting this right. I
want my code to keep asking users to enter the correct gender, but it
isn’t working… Down below you can see a very messy code, any help?

class GenderError < Exception
end

class Person
def gendercheck(x)
if (x.upcase != ‘FEMALE’) && (x.upcase != ‘MALE’)
raise GenderError
else
puts “You are a #{x}”
end
end
def initialize(gender)
@condition = false
@gender = gender
self.gendercheck(@gender)
rescue GenderError
puts “You put the wrong thing as a gender :: #{@gender}”
self.redo(@gender)
end
def redo(y)
@y = y
@y = gets()
if (@y.upcase != ‘FEMALE’) && (@y.upcase != ‘MALE’)
raise GenderError
else
@condition = true
self.gendercheck(@y)
end
rescue GenderError
if @condition == false
puts “Wrong Input again:: #{@y}”
self.redo(@y)
else
puts “You are a #{@y}”
end
end
attr_accessor :gender
end

First, “is not working” is not a very helpful description of the error.
In what respect is it not working?

Secondly, if you post code, please format it properly, with correct
indenting (and doesn’t contain tab characters). In the way you wrote it,
it is nearly unreadable.

If you have reason to think that posting the code in the forum messes up
indentation, you can also upload the code at https://gist.github.com/
and provide a link to it in your posting. This has the advantage that
the code gets syntax highligthing and is even easier to read.