[rubygems/rubygems] standardize pretty-print output for Gem::Source and subclasses

6d5fbf82f1
This commit is contained in:
Durable Programming Team 2024-09-02 15:16:31 -04:00 committed by git
parent 767d0a1716
commit 675529b9c6
9 changed files with 52 additions and 20 deletions

View file

@ -157,12 +157,14 @@ class Gem::Source::Git < Gem::Source
end
def pretty_print(q) # :nodoc:
q.group 2, "[Git: ", "]" do
q.breakable
q.text @repository
q.object_group(self) do
q.group 2, "[Git: ", "]" do
q.breakable
q.text @repository
q.breakable
q.text @reference
q.breakable
q.text @reference
end
end
end

View file

@ -32,6 +32,8 @@ class Gem::Source::Installed < Gem::Source
end
def pretty_print(q) # :nodoc:
q.text "[Installed]"
q.object_group(self) do
q.text "[Installed]"
end
end
end

View file

@ -117,10 +117,14 @@ class Gem::Source::Local < Gem::Source
end
def pretty_print(q) # :nodoc:
q.group 2, "[Local gems:", "]" do
q.breakable
q.seplist @specs.keys do |v|
q.text v.full_name
q.object_group(self) do
q.group 2, "[Local gems:", "]" do
q.breakable
if @specs
q.seplist @specs.keys do |v|
q.text v.full_name
end
end
end
end
end

View file

@ -42,9 +42,11 @@ class Gem::Source::SpecificFile < Gem::Source
end
def pretty_print(q) # :nodoc:
q.group 2, "[SpecificFile:", "]" do
q.breakable
q.text @path
q.object_group(self) do
q.group 2, "[SpecificFile:", "]" do
q.breakable
q.text @path
end
end
end