Class: Teams::Plugins::Identity

Inherits:
Teams::Plugin show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/teams/plugins/identity.rb

Defined Under Namespace

Classes: IdentityStruct

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Teams::Plugin

all_plugins, for, inherited, #initialize, missing_key_error_message

Constructor Details

This class inherits a constructor from Teams::Plugin

Class Method Details

.validation_errors(teams) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/teams/plugins/identity.rb', line 19

def self.validation_errors(teams)
  errors = T.let([], T::Array[String])

  uniq_set = Set.new
  teams.each do |team|
    for_team = self.for(team)

    if !uniq_set.add?(for_team.identity.name)
      errors << "More than 1 definition for #{for_team.identity.name} found"
    end

    errors << missing_key_error_message(team, 'name') if for_team.identity.name.nil?
  end

  errors
end

Instance Method Details

#identityObject



12
13
14
15
16
# File 'lib/teams/plugins/identity.rb', line 12

def identity
  IdentityStruct.new(
    @team.raw_hash['name']
  )
end