You don't need globals here. In fact, $global variables in ruby are kind of poisonous and should be avoided in most cases.