Class: Cobench::Mask
- Inherits:
-
Object
- Object
- Cobench::Mask
- Defined in:
- lib/cobench/mask.rb
Overview
Mask to apply for a repo name.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2022 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#initialize(txt) ⇒ Mask
constructor
A new instance of Mask.
- #matches?(repo) ⇒ Boolean
Constructor Details
#initialize(txt) ⇒ Mask
Returns a new instance of Mask.
26 27 28 |
# File 'lib/cobench/mask.rb', line 26 def initialize(txt) @org, @repo = txt.downcase.split('/') end |
Instance Method Details
#matches?(repo) ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/cobench/mask.rb', line 30 def matches?(repo) org, repo = repo.downcase.split('/') return false if ['', nil].include?(org) return false if ['', nil].include?(repo) return false if org != @org && @org != '*' return false if repo != @repo && @repo != '*' true end |