Skip to content

Commit

Permalink
Uses anonymous block forwarding as suggested by Rubocop
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Kämper <[email protected]>
  • Loading branch information
s2k committed Dec 27, 2024
1 parent 71de9f9 commit 33a7e0b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/limit_detectors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@
#
module LimitDetectors
# Deprecated, use at_most? instead
def at_most(limit, &block)
def at_most(limit, &)
Kernel.warn "'at_most' is deprecated, use 'at_most?' instead"
at_most? limit, &block
at_most? limit, &
end

# Deprecated, use at_least? instead
def at_least(limit, &block)
def at_least(limit, &)
Kernel.warn "'at_least' is deprecated, use 'at_least?' instead"
at_least? limit, &block
at_least? limit, &
end

# Check whether the condition given in the block
# occurs at most limit times in the collection
def at_most?(limit, &block)
occurrences_of(&block) <= limit
def at_most?(limit, &)
occurrences_of(&) <= limit
end

# Check whether the condition given in the block
# occurs at least limit times in the collection
def at_least?(limit, &block)
occurrences_of(&block) >= limit
def at_least?(limit, &)
occurrences_of(&) >= limit
end

# Count how often the condition given in the block
Expand Down

0 comments on commit 33a7e0b

Please sign in to comment.