Class: Dry::Monads::SuperDiff::ITBuilders::Dict Private

Inherits:
SuperDiff::Basic::InspectionTreeBuilders::Hash
  • Object
show all
Defined in:
lib/dry/monads/extensions/super_diff.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.applies_to?(object) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


322
# File 'lib/dry/monads/extensions/super_diff.rb', line 322

def self.applies_to?(object) = object.is_a?(::Dry::Monads::SuperDiff::Dict)

Instance Method Details

#callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/dry/monads/extensions/super_diff.rb', line 324

def call
  ::SuperDiff::Core::InspectionTree.new do |t1|
    t1.only_when empty do |t2|
      t2.as_lines_when_rendering_to_lines do |t3|
        t3.add_text "{}"
      end
    end

    t1.only_when nonempty do |t2|
      t2.nested do |t3|
        t3.insert_hash_inspection_of(object)
      end
    end
  end
end