Revised the Ruby snippets to conform to Rubocop rules.