module T::Private::Methods::CallValidation
def self.create_validator_method_medium0(mod, original_method, method_sig, original_visibility, return_type)
def self.create_validator_method_medium0(mod, original_method, method_sig, original_visibility, return_type) T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk| # This method is a manually sped-up version of more general code in `validate_call` # The following line breaks are intentional to show nice pry message # PRY note: # this code is sig validation code. # Please issue `finish` to step out of it return_value = original_method.bind(self).call(&blk) unless return_type.valid?(return_value) message = method_sig.return_type.error_message_for_obj(return_value) if message CallValidation.report_error( method_sig, message, 'Return value', nil, method_sig.return_type, return_value, caller_offset: -1 ) end end return_value end end