class Gm::Notepad::ThroughputText
Keep the original text close to the text that we are changing. This way we can dump the original text as a comment.
Attributes
text_to_evaluate[RW]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/gm/notepad/throughput_text.rb, line 11 def initialize(*args) super self.text_to_evaluate = original_text.strip original_text.freeze end
Public Instance Methods
[](*args)
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 27 def [](*args) @text_to_evaluate[*args] end
evaluate!()
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 49 def evaluate! lines_for_rendering.each do |line| line.expand! end end
for_rendering(text:, **kwargs)
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 41 def for_rendering(text:, **kwargs) @lines_for_rendering << LineForRendering.new(text: text, table_registry: table_registry, **kwargs) end
lines_for_rendering()
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 55 def lines_for_rendering @lines_for_rendering end
Also aliased as: lines
match(regexp)
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 19 def match(regexp) text_to_evaluate.match(regexp) end
render_current_text(**kwargs)
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 45 def render_current_text(**kwargs) for_rendering(text: text_to_evaluate, **kwargs) end
sub!(from, to)
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 23 def sub!(from, to) @text_to_evaluate = text_to_evaluate.sub(from, to) end
to_s()
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 35 def to_s @text_to_evaluate.to_s end
to_str()
click to toggle source
# File lib/gm/notepad/throughput_text.rb, line 31 def to_str @text_to_evaluate.to_str end