class Warg::Console::Content
Public Class Methods
new(text, console)
click to toggle source
# File lib/warg.rb, line 389 def initialize(text, console) @text = text.to_s.freeze @console = console end
Public Instance Methods
inspect()
click to toggle source
# File lib/warg.rb, line 418 def inspect %{#<#{self.class.name} newline_count=#{newline_count} last_line_length=#{last_line_length} text=#{@text.inspect}>} end
last_line_length()
click to toggle source
# File lib/warg.rb, line 404 def last_line_length if @text.empty? || @text.end_with?("\n") 0 else # Remove CSI sequences so they don't count against the length of the line because # they are invisible in the terminal @text.lines.last.gsub(/\e\[\d+;\d+;\d+m/, "").length end end
newline_count()
click to toggle source
# File lib/warg.rb, line 400 def newline_count @text.count("\n") end
text=(value)
click to toggle source
# File lib/warg.rb, line 394 def text=(value) @text = value.to_s.freeze @console.reprint_content(self) value end
to_s()
click to toggle source
# File lib/warg.rb, line 414 def to_s @text end