Class: SuperDiff::ObjectInspection::InspectionTreeBuilders::Primitive

Inherits:
Base
  • Object
show all
Defined in:
lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.applies_to?(value) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb', line 5

def self.applies_to?(value)
  SuperDiff.primitive?(value) || value.is_a?(::String)
end

Instance Method Details

#callObject



9
10
11
12
13
14
15
# File 'lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb', line 9

def call
  InspectionTree.new do |t1|
    t1.as_lines_when_rendering_to_lines do |t2|
      t2.add_text object.inspect
    end
  end
end