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.



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

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

Instance Attribute Details

#heightObject

Returns the value of attribute height.



312
313
314
# File 'lib/ruby_rich/app_shell.rb', line 312

def height
  @height
end

#widthObject

Returns the value of attribute width.



312
313
314
# File 'lib/ruby_rich/app_shell.rb', line 312

def width
  @width
end

Instance Method Details

#renderObject



320
321
322
323
324
325
326
327
# File 'lib/ruby_rich/app_shell.rb', line 320

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