Class: SuperDiff::ObjectInspection::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/super_diff/object_inspection/map.rb

Instance Method Summary collapse

Instance Method Details

#call(object) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/super_diff/object_inspection/map.rb', line 8

def call(object)
  if object.respond_to?(:attributes_for_super_diff)
    Inspectors::CustomObject
  else
    case object
    when Array
      Inspectors::Array
    when Hash
      Inspectors::Hash
    when String
      Inspectors::String
    when Time
      Inspectors::Time
    when true, false, nil, Symbol, Numeric, Regexp, Class
      Inspectors::Primitive
    else
      Inspectors::DefaultObject
    end
  end
end

#prepend(mod) ⇒ Object



4
5
6
# File 'lib/super_diff/object_inspection/map.rb', line 4

def prepend(mod)
  singleton_class.prepend(mod)
end