Make the check for a generate method compatible for both Ruby 1.8 and 1.9