<commit_before># encoding: utf-8

module Charging
  # Represents a object collection result. It is a delegator for an array of object.
  class Collection < SimpleDelegator

    # Responds the last http response from the API.
    attr_reader :last_response

    def initialize(response, attributes) # :nodoc:
      Helpers.required_arguments!(attributes.merge('response' => response))

      @last_response = response
      
      attributes.each do |attribute, value|
        instance_variable_set("@#{attribute}", value)
      end
      
      super(load_data_with_response!)
    end

    def load_data_with_response! # :nodoc:
      return [] if last_response.code != 200

      raw_domains = MultiJson.decode(last_response.body)
      raw_domains.map { |raw_domain| load_object_with(raw_domain) }
    end
  end
end<commit_msg>removing dirty code<commit_after># encoding: utf-8

module Charging
  # Represents a object collection result. It is a delegator for an array of object.
  class Collection < SimpleDelegator

    # Responds the last http response from the API.
    attr_reader :last_response

    def initialize(response, attributes) # :nodoc:
      Helpers.required_arguments!(attributes.merge('response' => response))

      @last_response = response
      
      attributes.each do |attribute, value|
        instance_variable_set("@#{attribute}", value)
      end
      
      super(load_data_with_response!)
    end

    def load_data_with_response! # :nodoc:
      return [] if last_response.code != 200

      raw_lines = MultiJson.decode(last_response.body)
      raw_lines.map { |raw_line| load_object_with(raw_line) }
    end
  end
end
{'fraction_non_alphanumeric': 0.08333333333333333, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 3.2816537467700257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2070126', 'n_tokens_mistral': 496, 'n_tokens_neox': 475, 'n_words': 129}