Module: Teams
- Extended by:
- T::Sig
- Defined in:
- lib/teams/plugin.rb,
lib/teams.rb,
lib/teams/plugins/identity.rb
Overview
Defined Under Namespace
Modules: Plugins
Classes: IncorrectPublicApiUsageError, Plugin, Team
Constant Summary
collapse
- UNKNOWN_TEAM_STRING =
'Unknown Team'
Class Method Summary
collapse
Class Method Details
.all ⇒ Object
20
21
22
23
|
# File 'lib/teams.rb', line 20
def self.all
@all = T.let(@all, T.nilable(T::Array[Team]))
@all ||= for_directory('config/teams')
end
|
.bust_caches! ⇒ Object
62
63
64
65
|
# File 'lib/teams.rb', line 62
def self.bust_caches!
@all = nil
@index_by_name = nil
end
|
.find(name) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/teams.rb', line 26
def self.find(name)
@index_by_name = T.let(@index_by_name, T.nilable(T::Hash[String, Teams::Team]))
@index_by_name ||= begin
result = {}
all.each { |t| result[t.name] = t }
result
end
@index_by_name[name]
end
|
.for_directory(dir) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/teams.rb', line 38
def self.for_directory(dir)
Pathname.new(dir).glob('**/*.yml').map do |path|
Team.from_yml(path.to_s)
rescue Psych::SyntaxError
raise IncorrectPublicApiUsageError, "The YML in #{path} has a syntax error!"
end
end
|
.tag_value_for(string) ⇒ Object
54
55
56
|
# File 'lib/teams.rb', line 54
def self.tag_value_for(string)
string.tr('&', ' ').gsub(/\s+/, '_').downcase
end
|
.validation_errors(teams) ⇒ Object
47
48
49
50
51
|
# File 'lib/teams.rb', line 47
def self.validation_errors(teams)
Plugin.all_plugins.flat_map do |plugin|
plugin.validation_errors(teams)
end
end
|