lib/gitlab/cli_helpers.rb in gitlab-4.14.0 vs lib/gitlab/cli_helpers.rb in gitlab-4.14.1

- old
+ new

@@ -204,29 +204,23 @@ [arr, keys] end # Helper function to call Gitlab commands with args. def gitlab_helper(cmd, args = []) - begin - data = args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd) - rescue StandardError => e - puts e.message - yield if block_given? - end - - data + args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd) + rescue StandardError => e + puts e.message + yield if block_given? end # Convert a hash (recursively) to use symbol hash keys # @return [Hash] def symbolize_keys(hash) if hash.is_a?(Hash) hash = hash.each_with_object({}) do |(key, value), new_hash| - begin - new_hash[key.to_sym] = symbolize_keys(value) - rescue NoMethodError - raise "Error: cannot convert hash key to symbol: #{key}" - end + new_hash[key.to_sym] = symbolize_keys(value) + rescue NoMethodError + raise "Error: cannot convert hash key to symbol: #{key}" end end hash end