Class: RubyRich::AppShell::StatusView

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_rich/app_shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell) ⇒ StatusView

Returns a new instance of StatusView.



308
309
310
311
312
# File 'lib/ruby_rich/app_shell.rb', line 308

def initialize(shell)
  @shell = shell
  @width = 0
  @height = 1
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



306
307
308
# File 'lib/ruby_rich/app_shell.rb', line 306

def height
  @height
end

#widthObject

Returns the value of attribute width.



306
307
308
# File 'lib/ruby_rich/app_shell.rb', line 306

def width
  @width
end

Instance Method Details

#renderObject



314
315
316
317
318
319
320
321
# File 'lib/ruby_rich/app_shell.rb', line 314

def render
  theme = @shell.theme
  focus = @shell.focus_manager.focused_name || :none
  progress = @shell.instance_variable_get(:@progress_text)
  status = progress || @shell.instance_variable_get(:@status)
  line = "#{theme.style(status, :accent)}  #{theme.style('focus: ' + focus.to_s, :muted)}  #{theme.style('Tab focus · Ctrl+C quit · /quit', :dim)}"
  [line]
end