<commit_before>module Rubberry
  module Fields
    class Base
      class ValueProxy < Proxy
      end

      class ArrayProxy < Proxy
        # TODO: override all methods that change internal state of array.
        # They should keep objects as proxy.
        def objectize(value)
          ::Array.wrap(value).flatten.map{|v| __field__.proxy(v, __field__) }
        end

        def elasticize
          return nil if __target__.nil?
          _target.map(&:elasticize)
        end
      end

      TYPES = %w{string object integer long short byte double float boolean date token_count binary}.freeze

      attr_reader :options, :name, :children

      def initialize(name, options = {})
        @default = options.delete(:default)
        @as_array = options.delete(:array)
        @options = options
        @name = name.to_s
        @children = []
      end<commit_msg>Fixed bug in array field's type<commit_after>module Rubberry
  module Fields
    class Base
      class ValueProxy < Proxy
      end

      class ArrayProxy < Proxy
        # TODO: override all methods that change internal state of array.
        # They should keep objects as proxy.
        def objectize(value)
          ::Array.wrap(value).flatten.map{|v| __field__.proxy(v, __field__) }
        end

        def elasticize
          return nil if __target__.nil?
          __target__.map(&:elasticize)
        end
      end

      TYPES = %w{string object integer long short byte double float boolean date token_count binary}.freeze

      attr_reader :options, :name, :children

      def initialize(name, options = {})
        @default = options.delete(:default)
        @as_array = options.delete(:array)
        @options = options
        @name = name.to_s
        @children = []
      end
{'fraction_non_alphanumeric': 0.08065425831923294, 'fraction_numerical': 0.0, 'mean_word_length': 2.1792114695340503, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5257414', 'n_tokens_mistral': 486, 'n_tokens_neox': 470, 'n_words': 152}