<commit_before>module CasClient
  
  module Response
    
    class Profile
      
      include CasClient::Logger
      include Enumerable
      
      def initialize(attributes)
        @attributes = attributes.with_indifferent_access
        if empty?
          logger.warn('[CAS] WARN: profile is empty')
        else
          logger.debug("[CAS] Profile is: #{self}")
        end
      end
      
      def attributes(*keys)
        returning({}.with_indifferent_access) do |attributes|
          keys.each do |key|
            value = @attributes[key]
            attributes[key] = value unless value.nil?
          end
        end
      end
      
      def each(&block)
        @attributes.each(&block)
      end
      
      def empty?
        @attributes.empty?
      end
      
      def value(key)
        @attributes[key.to_sym]
      end
      alias_method :[], :value
      
      def to_s
        @attributes.inspect
      end
      
    end
    
  end
  
end<commit_msg>small code improvment<commit_after>module CasClient
  
  module Response
    
    class Profile
      
      include CasClient::Logger
      include Enumerable
      
      def initialize(attributes)
        @attributes = attributes.with_indifferent_access
        if empty?
          logger.warn('[CAS] WARN: profile is empty')
        else
          logger.debug("[CAS] Profile is: #{self}")
        end
      end
      
      def attributes(*keys)
        @attributes.slice(*keys)
      end
      
      def each(&block)
        @attributes.each(&block)
      end
      
      def empty?
        @attributes.empty?
      end
      
      def value(key)
        @attributes[key.to_sym]
      end
      alias_method :[], :value
      
      def to_s
        @attributes.inspect
      end
      
    end
    
  end
  
end
{'fraction_non_alphanumeric': 0.07739082365948037, 'fraction_numerical': 0.0, 'mean_word_length': 1.4862637362637363, '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': '909724', 'n_tokens_mistral': 507, 'n_tokens_neox': 505, 'n_words': 120}