Module: LightIO::Library::Thread::FallbackHelper::ClassMethods

Included in:
LightIO::Library::Thread::FallbackHelper
Defined in:
lib/lightio/library/thread.rb

Instance Method Summary collapse

Instance Method Details

#fallback_method(obj, method, warning_text) ⇒ Object



48
49
50
51
52
53
# File 'lib/lightio/library/thread.rb', line 48

def fallback_method(obj, method, warning_text)
  define_method method do |*args|
    warn warning_text
    obj.public_send method, *args
  end
end

#fallback_thread_class_methods(*methods) ⇒ Object



55
56
57
58
59
60
# File 'lib/lightio/library/thread.rb', line 55

def fallback_thread_class_methods(*methods)
  methods.each {|m| fallback_method(RAW_THREAD.main, m, "This method is fallback to native Thread class,"\
                                           " it may cause unexpected behaviour,"\
                                           " open issues on https://github.com/socketry/lightio/issues"\
                                           " if this behaviour not approach you purpose")}
end