class RSpec::Matchers::BuiltIn::Equal

Not intended to be instantiated directly.
Provides the implementation for ‘equal`.
@api private

def actual_inspected

def actual_inspected
  if LITERAL_SINGLETONS.include?(actual)
    actual_formatted
  else
    inspect_object(actual)
  end
end

def detailed_failure_message

def detailed_failure_message
  <<-MESSAGE
 #{inspect_object(expected)}
 #{inspect_object(actual)}
 using equal?, which compares object identity,
cted and actual are not the same object. Use
actual).to eq(expected)` if you don't care about
dentity in this example.
end

def diffable?

Returns:
  • (Boolean) -

Other tags:
    Api: - private
def diffable?
  !expected_is_a_literal_singleton?
end

def expected_is_a_literal_singleton?

def expected_is_a_literal_singleton?
  LITERAL_SINGLETONS.include?(expected)
end

def failure_message

Returns:
  • (String) -

Other tags:
    Api: - private
def failure_message
  if expected_is_a_literal_singleton?
    simple_failure_message
  else
    detailed_failure_message
  end
end

def failure_message_when_negated

Returns:
  • (String) -

Other tags:
    Api: - private
def failure_message_when_negated
  <<-MESSAGE
 not #{inspect_object(actual)}
 got #{inspect_object(expected)}
 using equal?, which compares object identity.
end

def inspect_object(o)

def inspect_object(o)
  "#<#{o.class}:#{o.object_id}> => #{RSpec::Support::ObjectFormatter.format(o)}"
end

def match(expected, actual)

def match(expected, actual)
  actual.equal? expected
end

def simple_failure_message

def simple_failure_message
  "\nexpected #{expected_formatted}\n     got #{actual_inspected}\n"
end