<commit_before>require "luego/delegate"
require "thread"

module Luego
  class Future < Delegate
    private :delegate!, :undelegate!, :delegating?

    def initialize(thread = nil, &block)
      @thread = thread || ::Thread.new(&block)
      @thread.run
    end

    def method_missing(*args, &block)
      await!
      super
    end
    
    def await!
      return @child unless @child.nil?

      @child = @thread.value
    end

    def delegating?
      !@thread.alive?
    end

    alias :ready? :delegating?
  end
end<commit_msg>should add support for rubinus, which handles Thread#run slightly differently<commit_after>require "luego/delegate"
require "thread"

module Luego
  class Future < Delegate
    private :delegate!, :undelegate!, :delegating?

    def initialize(thread = nil, &block)
      @thread = thread || ::Thread.new(&block)
    end

    def method_missing(*args, &block)
      await!
      super
    end
    
    def await!
      return @child unless @child.nil?

      @child = @thread.value
    end

    def delegating?
      !@thread.alive?
    end

    alias :ready? :delegating?
  end
end
{'fraction_non_alphanumeric': 0.1037567084078712, 'fraction_numerical': 0.0, 'mean_word_length': 2.633116883116883, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4641588', 'n_tokens_mistral': 358, 'n_tokens_neox': 345, 'n_words': 99}