lib/matchi/match.rb in matchi-0.0.2 vs lib/matchi/match.rb in matchi-0.0.3
- old
+ new
@@ -3,9 +3,13 @@
class Match < BasicObject
def initialize(expected)
@expected = expected
end
+ # @example Is it matching /^foo$/ regex?
+ # match = Matchi::Match.new(/^foo$/)
+ # match.matches? { 'foo' } # => true
+ #
# @return [Boolean] Comparison between actual and expected values.
def matches?
@expected.match(yield).nil?.equal?(false)
end
end