Skip to content

Commit

Permalink
Refactor to avoid Lint/AssignmentInCondition
Browse files Browse the repository at this point in the history
Give block to `match` instead of using an `if`
See https://ruby-doc.org/core-2.1.1/Regexp.html#method-i-match

Signed-off-by: Alexander Fisher <[email protected]>
  • Loading branch information
alexjfisher committed Sep 24, 2016
1 parent 3f6cef9 commit 27af372
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/puppet/provider/package/pear.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def self.pearlist(hash)
begin
list = execute(command).split("\n")
list = list.map do |set|
if match = %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) # rubocop:disable Lint/AssignmentInCondition
channel = match[1].downcase
end
%r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) { |m| channel = m[1].downcase }

if hash[:justme]
if set =~ %r{^#{hash[:justme]}}
Expand Down

0 comments on commit 27af372

Please sign in to comment.