Sha256: 33240cb1cd9552333eb742a0fc29955f30bc8cccaf9d56ed465e7b262097c981
Contents?: true
Size: 556 Bytes
Versions: 16
Compression:
Stored size: 556 Bytes
Contents
module Kernel # Returns the object id as a string in hexideciaml, # which is how Ruby reports them with inspect. # # "ABC".object_hexid #=> "0x402d359c" # def object_hexid return "0x" << ('%.x' % (2*self.__id__))[1..-1] end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCKernel < Test::Unit::TestCase def test_object_hexid o = Object.new assert( o.inspect.index( o.object_hexid ) ) end end =end
Version data entries
16 entries across 16 versions & 1 rubygems