class SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::InstanceOf

Public Class Methods

applies_to?(value) click to toggle source
# File lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb, line 6
def self.applies_to?(value)
  SuperDiff::RSpec.an_instance_of_something?(value) || SuperDiff::RSpec.instance_of_something?(value)
end

Public Instance Methods

call() click to toggle source
# File lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb, line 10
def call
  SuperDiff::ObjectInspection::InspectionTree.new do
    add_text do |value|
      klass = if SuperDiff::RSpec.an_instance_of_something?(value)
                value.expected
              else
                value.instance_variable_get(:@klass)
              end
      "#<an instance of #{klass}>"
    end
  end
end