Refactoring the ruby_002.rb