Refactoring code by gem 'Rubocop'
Refactoring iterator