Snippets of ruby code while trying to learn Ruby