Sha256: 64591ed6213891ac3dccc110ac25d8414089e56e57395333d77010dba23c1c27

Contents?: true

Size: 414 Bytes

Versions: 11

Compression:

Stored size: 414 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)
    end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
goodcheck-2.4.3 lib/goodcheck/glob.rb
goodcheck-2.4.2 lib/goodcheck/glob.rb
goodcheck-2.4.1 lib/goodcheck/glob.rb
goodcheck-2.4.0 lib/goodcheck/glob.rb
goodcheck-2.3.2 lib/goodcheck/glob.rb
goodcheck-2.3.1 lib/goodcheck/glob.rb
goodcheck-2.3.0 lib/goodcheck/glob.rb
goodcheck-2.2.0 lib/goodcheck/glob.rb
goodcheck-2.1.2 lib/goodcheck/glob.rb
goodcheck-2.1.1 lib/goodcheck/glob.rb
goodcheck-2.1.0 lib/goodcheck/glob.rb