<commit_before>module Loady
  class AttributeArray < Array

    # usage:
    # aa = Loady::AttributeArray.new(['john', 'doe'])
    # aa.to_attributes([:first, :last])
    # => { first: 'john', last: 'doe' }
    #
    # options:
    #   strip: false    -- default = true
    #                   -- array values must be strings if :strip is true
    def to_attributes(names, options={})
      options = { strip: true }.merge(options)

      h = {}

      names.each_with_index do |name, i|
        if i < self.size
          if options[:strip] && self[i]
            h[name] = self[i].strip
          else
            h[name] = self[i]
          end
        else
          h[name] = nil
        end
      end

      h
    end

  end
end<commit_msg>improve local variable name<commit_after>module Loady
  class AttributeArray < Array

    # usage:
    # aa = Loady::AttributeArray.new(['john', 'doe'])
    # aa.to_attributes([:first, :last])
    # => { first: 'john', last: 'doe' }
    #
    # options:
    #   strip: false    -- default = true
    #                   -- array values must be strings if :strip is true
    def to_attributes(names, options={})
      options = { strip: true }.merge(options)

      attr_hash = {}

      names.each_with_index do |name, i|
        if i < self.size
          if options[:strip] && self[i]
            attr_hash[name] = self[i].strip
          else
            attr_hash[name] = self[i]
          end
        else
          attr_hash[name] = nil
        end
      end

      attr_hash
    end

  end
end
{'fraction_non_alphanumeric': 0.12419146183699871, 'fraction_numerical': 0.0, 'mean_word_length': 1.6857638888888888, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3489033', 'n_tokens_mistral': 500, 'n_tokens_neox': 477, 'n_words': 126}