From 6b0afa3e9c52f2d43432d7aeab53eb9e517ffe96 Mon Sep 17 00:00:00 2001 From: Mike McQuaid <mike@mikemcquaid.com> Date: Mon, 24 Apr 2017 11:45:32 +0100 Subject: [PATCH] Remove puts_hash, require pp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I wasn鈥檛 aware this existed when I created puts_hash so: may as well remove it. --- Library/Homebrew/global.rb | 1 + Library/Homebrew/test/utils_spec.rb | 8 -------- Library/Homebrew/utils.rb | 16 ---------------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 6505ca54e0..108ca0cb72 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -10,6 +10,7 @@ require "exceptions" require "set" require "rbconfig" require "official_taps" +require "pp" ARGV.extend(HomebrewArgvExtension) diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index ffaa1f493f..be224990aa 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -270,12 +270,4 @@ describe "globally-scoped helper methods" do }.to raise_error(MethodDeprecatedError, %r{method.*replacement.*homebrew/homebrew-core.*homebrew/core}m) end end - - describe "#puts_hash" do - it "outputs a hash" do - expect { - puts_hash(a: 1, b: 2, c: [3, { "d"=>4 }]) - }.to output("a: 1\nb: 2\nc: [3, {\"d\"=>4}]\n").to_stdout - end - end end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 5e0ad5916b..edc540c453 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -526,19 +526,3 @@ def migrate_legacy_keg_symlinks_if_necessary end FileUtils.rm_rf legacy_pinned_kegs end - -def puts_hash(hash, indent: 0) - return hash unless hash.is_a? Hash - hash.each do |key, value| - indent_spaces = " " * (indent * 2) - printf "#{indent_spaces}#{key}:" - if value.is_a? Hash - puts - puts_hash(value, indent: indent+1) - else - puts " #{value}" - end - end - hash -end -alias ph puts_hash -- GitLab