Class: SuperDiff::ObjectInspection::Nodes::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/super_diff/object_inspection/nodes/text.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/text.rb', line 9

def self.method_name
  :add_text
end

.node_nameObject



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

def self.node_name
  :text
end

Instance Method Details

#render_to_lines(object) ⇒ Object



17
18
19
20
21
# File 'lib/super_diff/object_inspection/nodes/text.rb', line 17

def render_to_lines(object, **)
  # NOTE: This is a bit of a hack since it returns a string instead of a
  # Line, but it is handled in InspectionTree (see UpdateTieredLines)
  render_to_string(object)
end

#render_to_string(object) ⇒ Object



13
14
15
# File 'lib/super_diff/object_inspection/nodes/text.rb', line 13

def render_to_string(object)
  block ? evaluate_block(object).to_s : immediate_value.to_s
end