Sha256: f8a82ab0bb1f45b96796f0b17ecfb7567a539eb512466865e3878567ab3198ee

Contents?: true

Size: 555 Bytes

Versions: 10

Compression:

Stored size: 555 Bytes

Contents

class Object

  # 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

10 entries across 10 versions & 1 rubygems

Version Path
facets-1.0.3 packages/core/lib/facet/kernel/object_hexid.rb
facets-0.9.0 lib/nano/kernel/object_hexid.rb
facets-1.0.0 lib/facet/kernel/object_hexid.rb
facets-1.2.1 lib/facets/core/kernel/object_hexid.rb
facets-1.2.0 lib/facets/core/kernel/object_hexid.rb
facets-1.3.0 lib/facets/core/kernel/object_hexid.rb
facets-1.1.0 lib/facet/kernel/object_hexid.rb
facets-1.3.1 lib/facets/core/kernel/object_hexid.rb
facets-1.3.2 lib/facets/core/kernel/object_hexid.rb
facets-1.3.3 lib/facets/core/kernel/object_hexid.rb