Class: Cobench::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/cobench/match.rb

Overview

Match of masks.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2022 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(opts, loog) ⇒ Match

Returns a new instance of Match.



28
29
30
31
# File 'lib/cobench/match.rb', line 28

def initialize(opts, loog)
  @opts = opts
  @loog = loog
end

Instance Method Details

#matches?(repo) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cobench/match.rb', line 33

def matches?(repo)
  if !@opts[:include].empty? && @opts[:include].none? { |m| Cobench::Mask.new(m).matches?(repo) }
    @loog.debug("Excluding #{repo} due to lack of --include")
    return false
  end
  if @opts[:exclude].any? { |m| Cobench::Mask.new(m).matches?(repo) }
    @loog.debug("Excluding #{repo} due to --exclude")
    return false
  end
  true
end