Class: Teams::Plugin

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/teams/plugin.rb

Overview

Plugins allow a client to add validation on custom keys in the team YML. For now, only a single plugin is allowed to manage validation on a top-level key. In the future we can think of allowing plugins to be gracefully merged with each other.

Direct Known Subclasses

Teams::Plugins::Identity

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(team) ⇒ Plugin

Returns a new instance of Plugin.



14
15
16
# File 'lib/teams/plugin.rb', line 14

def initialize(team)
  @team = team
end

Class Method Details

.all_pluginsObject



24
25
26
27
28
# File 'lib/teams/plugin.rb', line 24

def self.all_plugins
  @all_plugins ||= T.let(@all_plugins, T.nilable(T::Array[T.class_of(Plugin)]))
  @all_plugins ||= []
  @all_plugins
end

.for(team) ⇒ Object



36
37
38
# File 'lib/teams/plugin.rb', line 36

def self.for(team)
  register_team(team)
end

.inherited(base) ⇒ Object

rubocop:disable Lint/MissingSuper



19
20
21
# File 'lib/teams/plugin.rb', line 19

def self.inherited(base) # rubocop:disable Lint/MissingSuper
  all_plugins << T.cast(base, T.class_of(Plugin))
end

.missing_key_error_message(team, key) ⇒ Object



41
42
43
# File 'lib/teams/plugin.rb', line 41

def self.missing_key_error_message(team, key)
  "#{team.name} is missing required key `#{key}`"
end

.validation_errors(teams) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



31
32
33
# File 'lib/teams/plugin.rb', line 31

def self.validation_errors(teams) # rubocop:disable Lint/UnusedMethodArgument
  []
end