Class: Fief::Mask

Inherits:
Object
  • Object
show all
Defined in:
lib/fief/mask.rb

Overview

Mask to apply for a repo name.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2023 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(txt) ⇒ Mask

Returns a new instance of Mask.



28
29
30
# File 'lib/fief/mask.rb', line 28

def initialize(txt)
  @org, @repo = txt.downcase.split('/')
end

Instance Method Details

#matches?(repo) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
# File 'lib/fief/mask.rb', line 32

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