class RSpec::Support::ObjectFormatter::UninspectableObjectInspector

Constants

OBJECT_ID_FORMAT

Public Class Methods

can_inspect?(object) click to toggle source
# File lib/rspec/support/object_formatter.rb, line 198
def self.can_inspect?(object)
  object.inspect
  false
rescue NoMethodError
  true
end

Public Instance Methods

inspect() click to toggle source
# File lib/rspec/support/object_formatter.rb, line 205
def inspect
  "#<#{klass}:#{native_object_id}>"
end
klass() click to toggle source
# File lib/rspec/support/object_formatter.rb, line 209
def klass
  Support.class_of(object)
end
native_object_id() click to toggle source

stackoverflow.com/a/2818916

# File lib/rspec/support/object_formatter.rb, line 214
def native_object_id
  OBJECT_ID_FORMAT % (object.__id__ << 1)
rescue NoMethodError
  # In Ruby 1.9.2, BasicObject responds to none of #__id__, #object_id, #id...
  '-'
end