Class: TLDR::SorbetCompatibility

Inherits:
Object
  • Object
show all
Defined in:
lib/tldr/sorbet_compatibility.rb

Class Method Summary collapse

Class Method Details

.unwrap_method(method) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/tldr/sorbet_compatibility.rb', line 3

def self.unwrap_method method
  return method unless defined? ::T::Private::Methods

  sig_or_method = ::T::Private::Methods.signature_for_method(method) || method

  if sig_or_method.is_a?(Method) || sig_or_method.is_a?(UnboundMethod)
    sig_or_method
  else # it's a T::Private::Methods::Signature
    sig_or_method.method
  end
end