class T::InterfaceWrapper

def self.dynamic_cast(obj, mod)

Parameters:
  • mod (Module) -- type to cast `obj` to
  • obj (Object) -- object to cast
def self.dynamic_cast(obj, mod)
  if obj.is_a?(T::InterfaceWrapper)
    target_obj = obj.__target_obj_DO_NOT_USE
    target_obj.is_a?(mod) ? target_obj : nil
  elsif obj.is_a?(mod)
    obj
  else
    nil
  end
end