Skip to content

Commit

Permalink
Satisfy rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre authored Mar 5, 2024
1 parent 4f5b6db commit 0189573
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/backports/3.2.0/enumerator/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
instance_eval <<-EOT, __FILE__, __LINE__ + 1
def Enumerator.product(*enums, **kwargs, &block)
if kwargs && !kwargs.empty?
raise ArgumentError.new("unknown keywords: " + kwargs.keys.map(&:inspect).join(", "))
raise ArgumentError, "unknown keywords: #{kwargs.keys.map(&:inspect).join(", ")}"
end
Enumerator::Product.new(*enums).each(&block)
end
EOT
else
def Enumerator.product(*enums, &block)
kwargs = enums[-1]
if kwargs.kind_of?(Hash) && !kwargs.empty?
if kwargs.is_a?(Hash) && !kwargs.empty?
raise ArgumentError.new("unknown keywords: " + kwargs.keys.map(&:inspect).join(", "))
end
Enumerator::Product.new(*enums).each(&block)
Expand Down Expand Up @@ -57,7 +57,7 @@ def size
return nil unless enum.respond_to?(:size)
size = enum.size
return size if size == nil || size == Float::INFINITY
return nil unless size.kind_of?(Integer)
return nil unless size.is_a?(Integer)
total_size *= size
end
total_size
Expand Down

0 comments on commit 0189573

Please sign in to comment.