Sha256: 1040eeada8c6df812eb9202015602c4dbd7a2546bd378fa93e5ba7a6e7a21743

Contents?: true

Size: 557 Bytes

Versions: 3

Compression:

Stored size: 557 Bytes

Contents

module Kernel

  if RUBY_VERSION < '1.9'

    # Returns the object id as a string in hexideciaml,
    # which is how Ruby reports them with inspect...
    #
    #   "ABC".object_hexid  #=> "0x402d359c"
    #
    def object_hexid
      hex = (__id__ << 1) #.to_s(16)
      "0x%x" % hex
    end

  else

    # Returns the object id as a string in hexideciaml,
    # which is how Ruby reports them with inspect...
    #
    #   "ABC".object_hexid  #=> "0x402d359c"
    #
    def object_hexid
      hex = (__id__ << 1)
      "0x%014x" % hex
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.9.0 lib/core/facets/kernel/object_hexid.rb
facets-2.9.0.pre.2 lib/core/facets/kernel/object_hexid.rb
facets-2.9.0.pre.1 lib/core/facets/kernel/object_hexid.rb