Sha256: eb799153352d09d4ed417d80497d52a54145e456172fbe16211486545d65a4f8

Contents?: true

Size: 1.28 KB

Versions: 36

Compression:

Stored size: 1.28 KB

Contents

module DeployGate
  module Xcode
    class LocalTeams

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

      # @param [String] id
      # @param [String] name
      # @param [String] profile_path
      # @return [void]
      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

      # @return [Fixnum]
      def teams_count
        @team_ids.count
      end

      # @return [Array<String>]
      def first_team_profile_paths
        return [] if @team_ids.empty?
        profile_paths(@team_ids.first)
      end

      # @return [Array<Hash>]
      #
      # [
      #   {id: xxxx, name: xxxxx},
      #   {id: xxxx, name: xxxxx}
      # ]
      #
      def teams
        teams = []
        @team_ids.each_with_index{|id, index| teams.push({id: id, name: @team_names[index]})}

        teams
      end

      # @param [String] id
      # @return [Array<String>]
      def profile_paths(id)
        return [] unless @team_ids.include?(id)

        @team_profile_paths[id]
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
deploygate-0.9.1 lib/deploygate/xcode/local_teams.rb
deploygate-0.9.0 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.6 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.5 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.4 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.3 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.2 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.1 lib/deploygate/xcode/local_teams.rb
deploygate-0.8.0 lib/deploygate/xcode/local_teams.rb
deploygate-0.7.0 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.8 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.7 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.6 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.5 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.4 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.3 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.2 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.1 lib/deploygate/xcode/local_teams.rb
deploygate-0.6.0 lib/deploygate/xcode/local_teams.rb
deploygate-0.5.6 lib/deploygate/xcode/local_teams.rb