Sha256: 0f7b92a2ad8050b3964a1933b2bf3606e09544ee73322119c8bf4a23f47c0fb7

Contents?: true

Size: 435 Bytes

Versions: 1

Compression:

Stored size: 435 Bytes

Contents

module Matchi
  # **Regular expressions** matcher.
  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
matchi-0.0.3 lib/matchi/match.rb