Class: Sevgi::Graphics::Mixtures::Render::Renderer::Inlines Private
- Inherits:
-
Object
- Object
- Sevgi::Graphics::Mixtures::Render::Renderer::Inlines
- 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
-
#initialize ⇒ void
constructor
private
Creates an inline splice tracker.
-
#join(output, indent:, separator:) ⇒ Array<Array<String>, nil>?
private
Joins marked output ranges into inline content.
-
#start(index, depth) ⇒ Array<Sevgi::Graphics::Mixtures::Render::Renderer::Inlines::Mark>
private
Starts an inline splice range.
-
#stop(index) ⇒ Integer
private
Ends the latest inline splice range.
Constructor Details
#initialize ⇒ void
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.
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.
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.
110 |
# File 'lib/sevgi/graphics/mixtures/render.rb', line 110 def stop(index) = @marks.last.stop = index |