<commit_before>module LaunchPass
  class User
    attr_reader :email
    attr_reader :first_name
    attr_reader :last_name
    attr_reader :avatar_url
    attr_reader :username

    def initialize(info_hash)
      @info_hash = info_hash
      @email = @info_hash["email"]
      @first_name = @info_hash["first_name"]
      @last_name = @info_hash["last_name"]
      @avatar_url = @info_hash["avatar_url"]
      @username = @info_hash["username"]
    end

    def member_of?(team_name)
      teams.include?(team_name)
    end

    def has_product?(product_name, wildcard = true)
      if !wildcard
        products.include?(product_name)
      else
        products.each do |product|
          return true if product =~ /#{Regexp.escape(product_name)}/
        end
        false
      end
    end

    def admin?
      member_of?('Admins')
    end

    def teams
      if @info_hash["teams"]
        @teams ||= @info_hash["teams"].map do |team_hash|
          team_hash["name"]
        end
      else
        []
      end
    end

    def products
      if @info_hash["products"]
        @products ||= @info_hash["products"].map do |product|
          product["name"]
        end
      else
        []
      end
    end
  end
end<commit_msg>Revert "better handling for nil collections"<commit_after>module LaunchPass
  class User
    attr_reader :email
    attr_reader :first_name
    attr_reader :last_name
    attr_reader :avatar_url
    attr_reader :username

    def initialize(info_hash)
      @info_hash = info_hash
      @email = @info_hash["email"]
      @first_name = @info_hash["first_name"]
      @last_name = @info_hash["last_name"]
      @avatar_url = @info_hash["avatar_url"]
      @username = @info_hash["username"]
    end

    def member_of?(team_name)
      teams.include?(team_name)
    end

    def has_product?(product_name, wildcard = true)
      if !wildcard
        products.include?(product_name)
      else
        products.each do |product|
          return true if product =~ /#{Regexp.escape(product_name)}/
        end
        false
      end
    end

    def admin?
      member_of?('Admins')
    end

    def teams
      if @info_hash["teams"]
        @teams ||= @info_hash["teams"].map do |team_hash|
          team_hash["name"]
        end
      end
    end

    def products
      if @info_hash["products"]
        @products ||= @info_hash["products"].map do |product|
          product["name"]
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10368570271364926, 'fraction_numerical': 0.0, 'mean_word_length': 2.241469816272966, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1037570', 'n_tokens_mistral': 795, 'n_tokens_neox': 789, 'n_words': 172}