diff options
author | Durable Programming Team <[email protected]> | 2024-09-02 15:16:31 -0400 |
---|---|---|
committer | git <[email protected]> | 2024-09-03 17:40:12 +0000 |
commit | 675529b9c662c0e69a71de12d7a22c68016186f5 (patch) | |
tree | c44d28d0dfe98a37c19e5186925a8db78cd869cd /lib/rubygems/source | |
parent | 767d0a171668fbfcc5bbd9c060bb59d192717ce3 (diff) |
[rubygems/rubygems] standardize pretty-print output for Gem::Source and subclasses
https://github.com/rubygems/rubygems/commit/6d5fbf82f1
Diffstat (limited to 'lib/rubygems/source')
-rw-r--r-- | lib/rubygems/source/git.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/source/installed.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/source/local.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/source/specific_file.rb | 8 |
4 files changed, 23 insertions, 13 deletions
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index bda63c6844..34f6851bc4 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -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 diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb index cbe12a0516..f5c96fee51 100644 --- a/lib/rubygems/source/installed.rb +++ b/lib/rubygems/source/installed.rb @@ -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 diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb index d81d8343a8..ba6eea1f9a 100644 --- a/lib/rubygems/source/local.rb +++ b/lib/rubygems/source/local.rb @@ -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 diff --git a/lib/rubygems/source/specific_file.rb b/lib/rubygems/source/specific_file.rb index e9b2753646..dde1d48a21 100644 --- a/lib/rubygems/source/specific_file.rb +++ b/lib/rubygems/source/specific_file.rb @@ -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 |