<commit_before>require 'forwardable'

module ActiveMocker
module Mock

  class Collection

    include Enumerable

    def initialize(collection=[])
      @collection = [*collection]
    end

    def <<(*records)
      collection.concat(records.flatten)
    end

    extend ::Forwardable
    def_delegators :@collection, :take, :push, :clear, :first, :last, :concat, :replace, :distinct, :uniq, :count, :size, :length, :empty?, :any?, :include?, :delete
    alias distinct uniq

    def select(&block)
      collection.select(&block)
    end

    def each(&block)
      collection.each do |item|
        block.call(item)
      end
    end

    def map(&block)
      collection.map do |item|
        block.call(item)
      end
    end

    def to_a
      @collection
    end

    def to_ary
      to_a
    end

    def hash
      @collection.hash
    end

    def ==(val)
      @collection == val
    end

    protected

    attr_accessor :collection

  end

end
end<commit_msg>New collection methods blank? and many?<commit_after>require 'forwardable'

module ActiveMocker
module Mock

  class Collection

    include Enumerable

    def initialize(collection=[])
      @collection = [*collection]
    end

    def <<(*records)
      collection.concat(records.flatten)
    end

    extend ::Forwardable
    def_delegators :@collection, :take, :push, :clear, :first, :last, :concat, :replace, :distinct, :uniq, :count, :size, :length, :empty?, :any?, :many?, :include?, :delete
    alias distinct uniq

    def select(&block)
      collection.select(&block)
    end

    def each(&block)
      collection.each do |item|
        block.call(item)
      end
    end

    def map(&block)
      collection.map do |item|
        block.call(item)
      end
    end

    def to_a
      @collection
    end

    def to_ary
      to_a
    end

    def hash
      @collection.hash
    end

    def ==(val)
      @collection == val
    end

    # Returns true if relation is blank.
    def blank?
      to_a.blank?
    end

    protected

    attr_accessor :collection

  end

end
end
{'fraction_non_alphanumeric': 0.10043457267020763, 'fraction_numerical': 0.0, 'mean_word_length': 2.3152, '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': '957290', 'n_tokens_mistral': 662, 'n_tokens_neox': 628, 'n_words': 185}