class SuperDiff::ObjectInspection::InspectionTree::UpdateTieredLines
Public Instance Methods
call()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 154 def call if rendering.is_a?(Array) concat_with_lines elsif rendering.is_a?(PrefixForNextNode) add_to_prefix elsif tiered_lines.any? add_to_last_line elsif index < nodes.size - 1 || rendering.is_a?(PreludeForNextNode) add_to_prelude else add_to_lines end end
Private Instance Methods
add_to_last_line()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 198 def add_to_last_line new_lines = tiered_lines[0..-2] + [ tiered_lines[-1].with_value_appended(rendering), ] [new_lines, prelude, prefix] end
add_to_lines()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 209 def add_to_lines new_lines = tiered_lines + [ Line.new( type: type, indentation_level: indentation_level, value: rendering, ), ] [new_lines, prelude, prefix] end
add_to_prefix()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 194 def add_to_prefix [tiered_lines, prelude, rendering + prefix] end
add_to_prelude()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 205 def add_to_prelude [tiered_lines, prelude + rendering, prefix] end
concat_with_lines()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 170 def concat_with_lines additional_lines = prefix_with( prefix, prepend_with(prelude, rendering), ) [tiered_lines + additional_lines, "", ""] end
prefix_with(prefix, text)
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 178 def prefix_with(prefix, text) if prefix.empty? text else [text[0].prefixed_with(prefix)] + text[1..-1] end end
prepend_with(prelude, text)
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 186 def prepend_with(prelude, text) if prelude.empty? text else [text[0].with_value_prepended(prelude)] + text[1..-1] end end
rendering()
click to toggle source
# File lib/super_diff/object_inspection/inspection_tree.rb, line 220 def rendering if defined?(@_rendering) @_rendering else @_rendering = node.render( object, preferably_as_lines: true, type: type, indentation_level: indentation_level, ) end end