123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Support::ObjectFormatter::DateTimeInspector Private

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, BaseInspector, Struct
Instance Chain:
self, BaseInspector, Struct
Inherits: RSpec::Support::ObjectFormatter::BaseInspector
Defined in: rspec-support/lib/rspec/support/object_formatter.rb

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

  • #inspect Internal use only

    ActiveSupport sometimes overrides inspect.

BaseInspector - Inherited

Class Method Details

.can_inspect?(object) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/object_formatter.rb', line 162

def self.can_inspect?(object)
  defined?(DateTime) && DateTime === object
end

Instance Method Details

#inspect

ActiveSupport sometimes overrides inspect. If ActiveSupport is defined use a custom format string that includes more time precision.

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/object_formatter.rb', line 168

def inspect
  if defined?(ActiveSupport)
    object.strftime(FORMAT)
  else
    object.inspect
  end
end