Module: Minitest::Distributed::DefinedRunnable

Extended by:
T::Sig
Defined in:
lib/minitest/distributed/enqueued_runnable.rb

Overview

This module defines some helper methods to deal with Minitest::Runnable

Class Method Summary collapse

Class Method Details

.find_class(name) ⇒ Object



35
36
37
38
# File 'lib/minitest/distributed/enqueued_runnable.rb', line 35

def self.find_class(name)
  name.split("::")
    .reduce(Object) { |ns, const| ns.const_get(const) } # rubocop:disable Sorbet/ConstantsFromStrings
end

.from_identifier(identifier) ⇒ Object



46
47
48
49
# File 'lib/minitest/distributed/enqueued_runnable.rb', line 46

def self.from_identifier(identifier)
  class_name, method_name = identifier.split("#", 2)
  find_class(T.must(class_name)).new(T.must(method_name))
end

.identifier(runnable) ⇒ Object



41
42
43
# File 'lib/minitest/distributed/enqueued_runnable.rb', line 41

def self.identifier(runnable)
  "#{T.must(runnable.class.name)}##{runnable.name}"
end