Merge pull request #2539 from MikeMcQuaid/pp-puts-hash
Remove puts_hash, require pp
This commit is contained in:
commit
581e3b791e
@ -10,6 +10,7 @@ require "exceptions"
|
|||||||
require "set"
|
require "set"
|
||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
require "official_taps"
|
require "official_taps"
|
||||||
|
require "pp"
|
||||||
|
|
||||||
ARGV.extend(HomebrewArgvExtension)
|
ARGV.extend(HomebrewArgvExtension)
|
||||||
|
|
||||||
|
|||||||
@ -270,12 +270,4 @@ describe "globally-scoped helper methods" do
|
|||||||
}.to raise_error(MethodDeprecatedError, %r{method.*replacement.*homebrew/homebrew-core.*homebrew/core}m)
|
}.to raise_error(MethodDeprecatedError, %r{method.*replacement.*homebrew/homebrew-core.*homebrew/core}m)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|||||||
@ -526,19 +526,3 @@ def migrate_legacy_keg_symlinks_if_necessary
|
|||||||
end
|
end
|
||||||
FileUtils.rm_rf legacy_pinned_kegs
|
FileUtils.rm_rf legacy_pinned_kegs
|
||||||
end
|
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
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user