class FullscreenTui::Footer

Constants

SEPERATOR

Attributes

message[RW]

Public Class Methods

new() click to toggle source
# File lib/fullscreen_tui/footer.rb, line 8
def initialize
  self.message = ''
end

Public Instance Methods

output(width:, lines:, current_line: parts = [ message, " click to toggle source
# File lib/fullscreen_tui/footer.rb, line 12
def output width:, lines:, current_line:
  parts = [
    message,
    "#{(current_line + 1).to_s.rjust lines.to_s.size}/#{lines}",
  ]
  part_width = width - parts[1].size - SEPERATOR.size
  parts[0] = if parts[0].size > part_width
    "#{parts[0][0...part_width - 3]}..."
  else
    parts[0].ljust part_width
  end
  parts.join SEPERATOR
end