class Goodcheck::Glob
Constants
- FNM_FLAGS
Attributes
encoding[R]
exclude[R]
pattern[R]
Public Class Methods
new(pattern:, encoding:, exclude:)
click to toggle source
# File lib/goodcheck/glob.rb, line 9 def initialize(pattern:, encoding:, exclude:) @pattern = pattern @encoding = encoding @exclude = exclude end
Public Instance Methods
==(other)
click to toggle source
# File lib/goodcheck/glob.rb, line 19 def ==(other) other.is_a?(Glob) && other.pattern == pattern && other.encoding == encoding && other.exclude == exclude end
test(path)
click to toggle source
# File lib/goodcheck/glob.rb, line 15 def test(path) path.fnmatch?(pattern, FNM_FLAGS) && !excluded?(path) end
Private Instance Methods
excluded?(path)
click to toggle source
# File lib/goodcheck/glob.rb, line 28 def excluded?(path) Array(exclude).any? { |exc| path.fnmatch?(exc, FNM_FLAGS) } end