fix rubocop warning 'MethodLength'