<commit_before>require "eventmachine"
require "bite_the_dust/version"

module BiteTheDust
  def future?(time)
      Time.now < time
  end

  def countdown(sec)

  end
  module_function :future?
  module_function :countdown

  class BiteTheDust
    def initialize(time)
      @now = Time.now
      @time = time
    end

    def future?
      @now < @time
    end

    def set_timer(function)
      if future? then
        begin
          num_of_seconds = @time - Time.now
          EM.run do
            EM.add_timer(num_of_seconds.to_i) do
              function.call
              yield if block_given?
              EM.stop_event_loop
            end
          end
        rescue RangeError
          puts "Time too far"
          false
        end
      else
        false
      end
    end
  end
end<commit_msg>set_timer return true if no problem<commit_after>require "eventmachine"
require "bite_the_dust/version"

module BiteTheDust
  def future?(time)
      Time.now < time
  end

  def countdown(sec)

  end
  module_function :future?
  module_function :countdown

  class BiteTheDust
    def initialize(time)
      @now = Time.now
      @time = time
    end

    def future?
      @now < @time
    end

    def set_timer(function)
      if future? then
        begin
          num_of_seconds = @time - Time.now
          EM.run do
            EM.add_timer(num_of_seconds.to_i) do
              function.call
              yield if block_given?
              EM.stop_event_loop
            end
          end
          true
        rescue RangeError
          puts "Time too far"
          false
        end
      else
        false
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.055188962207558485, 'fraction_numerical': 0.0, 'mean_word_length': 1.5622119815668203, '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': '7618639', 'n_tokens_mistral': 515, 'n_tokens_neox': 506, 'n_words': 137}