<commit_before>module Neo4j::ActiveNode
  module HasN
    extend ActiveSupport::Concern

    class NonPersistedNodeError < StandardError; end

    # Return this object from associations
    # It uses a QueryProxy to get results
    # But also caches results and can have results cached on it
    class AssociationProxy
      def initialize(query_proxy, cached_result = nil)
        @query_proxy = query_proxy
        cache_result(cached_result)

        # Represents the thing which can be enumerated
        # default to @query_proxy, but will be set to
        # @cached_result if that is set
        @enumerable = @query_proxy
      end

      # States:
      # Default
      def inspect
        if @cached_result
          result_nodes.inspect
        else
          "#<AssociationProxy @query_proxy=#{@query_proxy.inspect}>"
        end
      end

      extend Forwardable
      %w(include? empty? count find first last ==).each do |delegated_method|
        def_delegator :@enumerable, delegated_method
      end

      include Enumerable

      def each(&block)
        result_nodes.each(&block)
      end

      def ==(other)
        self.to_a == other.to_a
      end

      def +(other_nodes)
        self.to_a + other_nodes
      end

      def result<commit_msg>Rubocop<commit_after>module Neo4j::ActiveNode
  module HasN
    extend ActiveSupport::Concern

    class NonPersistedNodeError < StandardError; end

    # Return this object from associations
    # It uses a QueryProxy to get results
    # But also caches results and can have results cached on it
    class AssociationProxy
      def initialize(query_proxy, cached_result = nil)
        @query_proxy = query_proxy
        cache_result(cached_result)

        # Represents the thing which can be enumerated
        # default to @query_proxy, but will be set to
        # @cached_result if that is set
        @enumerable = @query_proxy
      end

      # States:
      # Default
      def inspect
        if @cached_result
          result_nodes.inspect
        else
          "#<AssociationProxy @query_proxy=#{@query_proxy.inspect}>"
        end
      end

      extend Forwardable
      %w(include? empty? count find first last ==).each do |delegated_method|
        def_delegator :@enumerable, delegated_method
      end

      include Enumerable

      def each(&block)
        result_nodes.each(&block)
      end

      def ==(other)
        self.to_a == other.to_a
      end

      def +(other)
        self.to_a + other
      end

      def result
{'fraction_non_alphanumeric': 0.0625, 'fraction_numerical': 0.0007911392405063291, 'mean_word_length': 2.221656050955414, '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': '752554', 'n_tokens_mistral': 724, 'n_tokens_neox': 692, 'n_words': 219}