<commit_before>module Soapforce
  class QueryResult
    include Enumerable

    attr_reader :raw_result

    def initialize(result_hash={})
      @raw_result = result_hash
      @result_records = [] # Default for 0 size response.
      if @raw_result[:size].to_i == 1
        @result_records = [@raw_result[:records]]
      elsif @raw_result[:records]
        @result_records = @raw_result[:records]
      end
    end

    # Implmentation for Enumerable mix-in.
    def each(&block)
      @result_records.each(&block)
    end

    def first
      @result_records.first
    end

    def last
      @result_records.last
    end

    def size
      @raw_result[:size] || 0
    end

    def done?
      @raw_result[:done] || true
    end

    def query_locator
      @raw_result[:query_locator]
    end
  end

end<commit_msg>Switch to method_missing in QueryResult to delegate calls to the internal array.<commit_after>module Soapforce
  class QueryResult
    include Enumerable

    attr_reader :raw_result

    def initialize(result_hash={})
      @raw_result = result_hash
      @result_records = [] # Default for 0 size response.
      if @raw_result[:size].to_i == 1
        @result_records = [@raw_result[:records]]
      elsif @raw_result[:records]
        @result_records = @raw_result[:records]
      end
    end

    # Implmentation for Enumerable mix-in.
    def each(&block)
      @result_records.each(&block)
    end

    def size
      @raw_result[:size] || 0
    end

    def done?
      @raw_result[:done] || true
    end

    def query_locator
      @raw_result[:query_locator]
    end

    def method_missing(method, *args, &block)
      @result_records.send(method, *args, &block)
    end
  end

end
{'fraction_non_alphanumeric': 0.0927654609101517, 'fraction_numerical': 0.003500583430571762, 'mean_word_length': 2.5953878406708597, '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': '6861449', 'n_tokens_mistral': 559, 'n_tokens_neox': 529, 'n_words': 132}