Your code does not work because the variable answer you return it's always the one in the first iteration (each call has its own local scope). So a possible solution is:
def ask_question(question)
print question
answer = STDIN.gets.chomp
answer.empty? ? ask_question(question) : answer
end
Note though that this recursive construction is fine with languages that support tail-call optimization, but Ruby does not force it, so it will usually create a new stack frame for each iteration and eventually it will blow. I'd recommend looping, for example:
def ask_question(question)
loop do
print question
answer = STDIN.gets.chomp
break answer unless answer.empty?
end
end