Eating at least two hours before class will make sure your stomach empties, so that will help gas in the stomach, or if you get reflux (esp. with all that rolling). But it won't necessarily do anything for gas in the intestine.
Things that might help that: avoid gas producing foods (esp for meals earlier in the day)---for most folks this is beans, onions, cabbage, cucumbers, melon, often milk. Also, gulping your meal, or talking and eating, may cause you to swallow air, increasing the gas problems. Solution? Eat like Mom always told you to, slowly and chewing carefully, and without a lot of talking at the table.