lib/matchi/satisfy.rb in matchi-3.0.0 vs lib/matchi/satisfy.rb in matchi-3.1.0

- old
+ new

@@ -1,10 +1,13 @@ # frozen_string_literal: true module Matchi # *Satisfy* matcher. class Satisfy + # @return [Proc] A block of code. + attr_reader :expected + # Initialize the matcher with a block. # # @example # require "matchi/satisfy" # @@ -19,17 +22,19 @@ # # @example # require "matchi/satisfy" # # matcher = Matchi::Satisfy.new { |value| value == 42 } + # + # matcher.expected # => #<Proc:0x00007fbaafc65540> # matcher.matches? { 42 } # => true # # @yieldreturn [#object_id] The actual value to compare to the expected # one. # # @return [Boolean] Comparison between actual and expected values. - def matches?(*, **) - @expected.call(yield) + def matches? + expected.call(yield) end # A string containing a human-readable representation of the matcher. def inspect "#{self.class}(&block)"