Class: Sevgi::Graphics::Mixtures::Render::Renderer::Inlines Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sevgi/graphics/mixtures/render.rb

Overview

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.

Inline-content output splice helper.

Defined Under Namespace

Classes: Mark

Instance Method Summary collapse

Constructor Details

#initializevoid

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.

Creates an inline splice tracker.



99
# File 'lib/sevgi/graphics/mixtures/render.rb', line 99

def initialize = @marks = []

Instance Method Details

#join(output, indent:, separator:) ⇒ Array<Array<String>, nil>?

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.

Joins marked output ranges into inline content.

Parameters:

  • output (Array<Array<String>, nil>)

    renderer output buffer

  • indent (String)

    indentation unit

  • separator (String)

    line separator

Returns:

  • (Array<Array<String>, nil>, nil)


117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/sevgi/graphics/mixtures/render.rb', line 117

def join(output, indent:, separator:)
  return if @marks.empty?

  @marks.each do |mark|
    depth = mark.depth

    ((mark.start + 1)..mark.stop).each do |i|
      output[i].map! { |line| line.delete_prefix(indent * (depth + 1)) }
      output[mark.start][-1] += output[i].join(separator)
      output[i] = nil
    end
  end

  output.compact!
end

#start(index, depth) ⇒ Array<Sevgi::Graphics::Mixtures::Render::Renderer::Inlines::Mark>

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.

Starts an inline splice range.

Parameters:

  • index (Integer)

    output index

  • depth (Integer)

    element depth

Returns:



105
# File 'lib/sevgi/graphics/mixtures/render.rb', line 105

def start(index, depth) = @marks << Mark.new(start: index, depth:)

#stop(index) ⇒ Integer

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.

Ends the latest inline splice range.

Parameters:

  • index (Integer)

    output index

Returns:

  • (Integer)


110
# File 'lib/sevgi/graphics/mixtures/render.rb', line 110

def stop(index) = @marks.last.stop = index