Class: DeployGate::Xcode::LocalTeams

Inherits:
Object
  • Object
show all
Defined in:
lib/deploygate/xcode/local_teams.rb

Instance Method Summary collapse

Constructor Details

#initializeLocalTeams

Returns a new instance of LocalTeams.



5
6
7
8
9
# File 'lib/deploygate/xcode/local_teams.rb', line 5

def initialize
  @team_ids = []
  @team_names = []
  @team_profile_paths = {}
end

Instance Method Details

#add(id, name, profile_path) ⇒ void

This method returns an undefined value.

Parameters:

  • id (String)
  • name (String)
  • profile_path (String)


15
16
17
18
19
20
21
22
23
24
# File 'lib/deploygate/xcode/local_teams.rb', line 15

def add(id, name, profile_path)
  unless @team_ids.include?(id)
    @team_ids.push(id)
    @team_names.push(name)

    @team_profile_paths[id] = []
  end

  @team_profile_paths[id].push(profile_path) unless @team_profile_paths.include?(profile_path)
end

#first_team_profile_pathsArray<String>

Returns:

  • (Array<String>)


32
33
34
35
# File 'lib/deploygate/xcode/local_teams.rb', line 32

def first_team_profile_paths
  return [] if @team_ids.empty?
  profile_paths(@team_ids.first)
end

#profile_paths(id) ⇒ Array<String>

Parameters:

  • id (String)

Returns:

  • (Array<String>)


53
54
55
56
57
# File 'lib/deploygate/xcode/local_teams.rb', line 53

def profile_paths(id)
  return [] unless @team_ids.include?(id)

  @team_profile_paths[id]
end

#teamsArray<Hash>

[

{id: xxxx, name: xxxxx},
{id: xxxx, name: xxxxx}

]

Returns:

  • (Array<Hash>)


44
45
46
47
48
49
# File 'lib/deploygate/xcode/local_teams.rb', line 44

def teams
  teams = []
  @team_ids.each_with_index{|id, index| teams.push({id: id, name: @team_names[index]})}

  teams
end

#teams_countFixnum

Returns:

  • (Fixnum)


27
28
29
# File 'lib/deploygate/xcode/local_teams.rb', line 27

def teams_count
  @team_ids.count
end