Class: SuperDiff::ObjectInspection::Nodes::WhenEmpty

Inherits:
Base
  • Object
show all
Defined in:
lib/super_diff/object_inspection/nodes/when_empty.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#clone_with, #initialize, #pretty_print, #render

Constructor Details

This class inherits a constructor from SuperDiff::ObjectInspection::Nodes::Base

Class Method Details

.method_nameObject



9
10
11
# File 'lib/super_diff/object_inspection/nodes/when_empty.rb', line 9

def self.method_name
  :when_empty
end

.node_nameObject



5
6
7
# File 'lib/super_diff/object_inspection/nodes/when_empty.rb', line 5

def self.node_name
  :when_empty
end

Instance Method Details

#render_to_lines(object, type:, indentation_level:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/super_diff/object_inspection/nodes/when_empty.rb', line 21

def render_to_lines(object, type:, indentation_level:)
  if empty?(object)
    render_to_lines_in_subtree(
      object,
      type: type,
      indentation_level: indentation_level,
    )
  else
    []
  end
end

#render_to_string(object) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/super_diff/object_inspection/nodes/when_empty.rb', line 13

def render_to_string(object)
  if empty?(object)
    render_to_string_in_subtree(object)
  else
    ""
  end
end