<commit_before>module Lol
  class LeagueRequest < Request
    # Returns the supported API Version
    # @return [String] the supported api version
    def self.api_version
      "v2.4"
    end

    # Retrieves leagues data for summoner, including leagues for all of summoner's teams
    # @param [String]
    # @return [Array]
    def get *summoner_ids
      returns = {}
      perform_request(api_url("league/by-summoner/#{summoner_ids.join(",")}")).each do |s, l|
        returns[s] = l.map {|data| League.new data}
      end
      returns
    end

    # Retrieves leagues entry data for summoner, including league entries for all of summoner's teams
    # @param [String]
    # @return [Array]
    # TODO: Change name to entries?
    def get_entries *summoner_ids
      perform_request(api_url("league/by-summoner/#{summoner_ids.join(',')}/entry")).map { |e| LeagueEntry.new e }
    end

    # Retrieves leagues data for team
    # @param [String]
    # @return [Array]
    def by_team *team_ids
      perform_request(api_url("league/by-team/#{team_ids.join(',')}")).map { |l| League.new l }
    end

    # Retrieves leagues entry data for team
    # @param [String]
    # @return [Array]
    # TODO: Change name to?
    def entries_by_team *team_ids
      perform_request(api_url("league/by-team/#{team_ids.join(',')}/entry")).map { |e| LeagueEntry.new e }
    end

    # Retrieves challenger tier leagues
    # @return [Array]
    def challenger
      perform_request(api_url('league/challenger')).map { |l| League.new l }
    end
  end
end
<commit_msg>Refactored get to use each_with_object.<commit_after>module Lol
  class LeagueRequest < Request
    # Returns the supported API Version
    # @return [String] the supported api version
    def self.api_version
      "v2.4"
    end

    # Retrieves leagues data for summoner, including leagues for all of summoner's teams
    # @param [String]
    # @return [Array]
    def get *summoner_ids
      perform_request(api_url("league/by-summoner/#{summoner_ids.join(",")}")).each_with_object({}) do |(s, l), returns|
        returns[s] = l.map {|data| League.new data}
      end
    end

    # Retrieves leagues entry data for summoner, including league entries for all of summoner's teams
    # @param [String]
    # @return [Array]
    # TODO: Change name to entries?
    def get_entries *summoner_ids
      perform_request(api_url("league/by-summoner/#{summoner_ids.join(',')}/entry")).map { |e| LeagueEntry.new e }
    end

    # Retrieves leagues data for team
    # @param [String]
    # @return [Array]
    def by_team *team_ids
      perform_request(api_url("league/by-team/#{team_ids.join(',')}")).map { |l| League.new l }
    end

    # Retrieves leagues entry data for team
    # @param [String]
    # @return [Array]
    # TODO: Change name to?
    def entries_by_team *team_ids
      perform_request(api_url("league/by-team/#{team_ids.join(',')}/entry")).map { |e| LeagueEntry.new e }
    end

    # Retrieves challenger tier leagues
    # @return [Array]
    def challenger
      perform_request(api_url('league/challenger')).map { |l| League.new l }
    end
  end
end

{'fraction_non_alphanumeric': 0.12213010204081633, 'fraction_numerical': 0.0012755102040816326, 'mean_word_length': 3.0687418936446176, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4893849', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1029, 'n_words': 277}