
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
