s2k/limit_detectors

View on GitHub
example/example.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require 'limit_detectors'

class Example
  include Enumerable
  def each(&block)
    ('a'..'d').each(&block)
  end
end

e = Example.new
e.extend LimitDetectors

puts e.at_least?(1) { |c| c == 'f' }
puts e.at_least?(1) { |c| c == 'b' }
puts e.at_most?(0)  { |c| c == 'b' }
puts e.at_most?(42) { |c| c == 'b' }