Sha256: 5118325e09574cf6655c54241e27fdc1c1a6c5bb68a8bce3018ad5e6c1f76cdf
Contents?: true
Size: 757 Bytes
Versions: 20
Compression:
Stored size: 757 Bytes
Contents
# frozen_string_literal: true module RBS module Test module Guaranteed module Inspect EQUAL = ::BasicObject.instance_method(:equal?) INSPECT = ::Kernel.instance_method(:inspect) private_constant :EQUAL, :INSPECT module_function def guaranteed_inspect(obj) obj.inspect rescue NoMethodError INSPECT.bind_call(obj) end def inspect string = "<#{self.class.name}:" instance_variables.each_with_index do |variable, index| string.concat ', ' unless index.zero? string.concat "#{variable}: #{guaranteed_inspect(instance_variable_get(variable))}" end string.concat '>' end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems