Figuring out how to do mode in ruby