They both were fliriting, looks like ruby make impression on him :) I like John, I think he maybe for some people behave stupid, but probably he trying to be more confident because inside he was shy ;)
He’s flirting with her, this is how he flirts, making sarcastic jokes… etc. if you didn’t pay attention you might just think he’s being funny but he’s flirting with her. Perhaps he got distracted by her dress…