File tree Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,13 @@ def self.blastlist(hash)
4141
4242 output = Puppet ::Util . withenv ( :PAGER => "/usr/bin/cat" ) { pkgget command }
4343
44- list = output . split ( "\n " ) . collect do |line |
44+ list = output . split ( "\n " ) . filter_map do |line |
4545 next if line =~ /^#/
4646 next if line =~ /^WARNING/
4747 next if line =~ /localrev\s +remoterev/
4848
4949 blastsplit ( line )
50- end . compact
50+ end
5151
5252 if hash [ :justme ]
5353 return list [ 0 ]
Original file line number Diff line number Diff line change @@ -120,8 +120,7 @@ def self.gemlist(options)
120120
121121 begin
122122 list = execute_gem_command ( options [ :command ] , command_options ) . lines
123- . map { |set | gemsplit ( set ) }
124- . compact
123+ . filter_map { |set | gemsplit ( set ) }
125124 rescue Puppet ::ExecutionFailure => detail
126125 raise Puppet ::Error , _ ( "Could not list gems: %{detail}" ) % { detail : detail } , detail . backtrace
127126 end
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def self.instances(hash = {})
6565 def self . availlist
6666 output = pkguti [ "-a" ]
6767
68- output . split ( "\n " ) . collect do |line |
68+ output . split ( "\n " ) . filter_map do |line |
6969 next if line =~ /^common\s +package/ # header of package list
7070 next if noise? ( line )
7171
@@ -74,7 +74,7 @@ def self.availlist
7474 else
7575 Puppet . warning _ ( "Cannot match %{line}" ) % { line : line }
7676 end
77- end . compact
77+ end
7878 end
7979
8080 # Turn our pkgutil -c listing into a hash for a single package.
@@ -94,12 +94,12 @@ def self.parse_pkglist(output, hash = {})
9494 return nil
9595 end
9696
97- list = output . collect do |line |
97+ list = output . filter_map do |line |
9898 next if line =~ /installed\s +catalog/ # header of package list
9999 next if noise? ( line )
100100
101101 pkgsplit ( line )
102- end . compact
102+ end
103103
104104 if hash [ :justme ]
105105 # Single queries may have been for an alias so return the name requested
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ def dochook(name, &block)
2020
2121 # Generate the full doc string.
2222 def doc
23- extra = methods . find_all { |m | m . to_s =~ /^dochook_.+/ } . sort . collect { |m |
23+ extra = methods . find_all { |m | m . to_s =~ /^dochook_.+/ } . sort . filter_map { |m |
2424 self . send ( m )
25- } . compact . collect { |r | "* #{ r } " } . join ( "\n " )
25+ } . collect { |r | "* #{ r } " } . join ( "\n " )
2626
2727 if @doc
2828 scrub ( @doc ) + ( extra . empty? ? '' : "\n \n #{ extra } " )
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ def initialize(type,
105105 def join ( details )
106106 joinchar = self . joiner
107107
108- fields . collect { |field |
108+ fields . filter_map { |field |
109109 # If the field is marked absent, use the appropriate replacement
110110 if details [ field ] == :absent or details [ field ] == [ :absent ] or details [ field ] . nil?
111111 if self . optional . include? ( field )
@@ -116,7 +116,7 @@ def join(details)
116116 else
117117 details [ field ] . to_s
118118 end
119- } . compact . join ( joinchar )
119+ } . join ( joinchar )
120120 end
121121
122122 # Customize this so we can do a bit of validation.
You can’t perform that action at this time.
0 commit comments