<commit_before>require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
require 'timeout'

describe "Extlib::Pooling" do
  before(:all) do

    module Extlib::Pooling
      def self.scavenger_interval
        0.1
      end
    end

    class Person
      include Extlib::Pooling

      attr_accessor :name

      def initialize(name)
        @name = name
      end

      def dispose
        @name = nil
      end

      def self.scavenge_interval
        0.2
      end
    end

    class Overwriter

      def self.new(*args)
        instance = allocate
        instance.send(:initialize, *args)
        instance.overwritten = true
        instance
      end

      include Extlib::Pooling

      attr_accessor :name

      def initialize(name)
        @name = name
        @overwritten = false
      end

      def overwritten?
        @overwritten
      end

      def overwritten=(value)
        @overwritten = value
      end

      def self.pool_size
        2
      end

      def dispose
        @name = nil<commit_msg>Changed the pool_size to 20 if executing specs on JRuby<commit_after>require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
require 'timeout'

describe "Extlib::Pooling" do
  before(:all) do

    module Extlib::Pooling
      def self.scavenger_interval
        0.1
      end
    end

    class Person
      include Extlib::Pooling

      attr_accessor :name

      def initialize(name)
        @name = name
      end

      def dispose
        @name = nil
      end

      def self.scavenge_interval
        0.2
      end
    end

    class Overwriter

      def self.new(*args)
        instance = allocate
        instance.send(:initialize, *args)
        instance.overwritten = true
        instance
      end

      include Extlib::Pooling

      attr_accessor :name

      def initialize(name)
        @name = name
        @overwritten = false
      end

      def overwritten?
        @overwritten
      end

      def overwritten=(value)
        @overwritten = value
      end

      def self.pool_size
        pool_size = if RUBY_PLATFORM =~ /java/
          20
        else
          2
        end
        pool_size
      end

      def dispose
        @name = nil
{'fraction_non_alphanumeric': 0.0657130084935181, 'fraction_numerical': 0.006258381761287439, 'mean_word_length': 1.683453237410072, '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': '2444993', 'n_tokens_mistral': 673, 'n_tokens_neox': 628, 'n_words': 172}