Sha256: 1a3f14d7342a6dbd2ff462310de292eb98379fcdb008114c78ddfff8d4c3d5d3

Contents?: true

Size: 435 Bytes

Versions: 5

Compression:

Stored size: 435 Bytes

Contents

module Goodcheck
  class Glob
    attr_reader :pattern
    attr_reader :encoding

    def initialize(pattern:, encoding:)
      @pattern = pattern
      @encoding = encoding
    end

    def test(path)
      path.fnmatch?(pattern, File::FNM_PATHNAME | File::FNM_EXTGLOB | File::FNM_DOTMATCH)
    end

    def ==(other)
      other.is_a?(Glob) &&
        other.pattern == pattern &&
        other.encoding == encoding
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
goodcheck-2.5.2 lib/goodcheck/glob.rb
goodcheck-2.5.1 lib/goodcheck/glob.rb
goodcheck-2.5.0 lib/goodcheck/glob.rb
goodcheck-2.4.5 lib/goodcheck/glob.rb
goodcheck-2.4.4 lib/goodcheck/glob.rb