Class: RubyRich::AppShell::FramedView
- Inherits:
-
Object
- Object
- RubyRich::AppShell::FramedView
- Defined in:
- lib/ruby_rich/app_shell.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #desired_height ⇒ Object
-
#initialize(component, title:, theme:, &focused) ⇒ FramedView
constructor
A new instance of FramedView.
- #render ⇒ Object
Constructor Details
#initialize(component, title:, theme:, &focused) ⇒ FramedView
Returns a new instance of FramedView.
327 328 329 330 331 332 333 334 |
# File 'lib/ruby_rich/app_shell.rb', line 327 def initialize(component, title:, theme:, &focused) @component = component @title = title @theme = theme @focused = focused @width = 0 @height = 0 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
325 326 327 |
# File 'lib/ruby_rich/app_shell.rb', line 325 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
325 326 327 |
# File 'lib/ruby_rich/app_shell.rb', line 325 def width @width end |
Instance Method Details
#desired_height ⇒ Object
344 345 346 347 348 |
# File 'lib/ruby_rich/app_shell.rb', line 344 def desired_height return @height unless @component.respond_to?(:desired_height) @component.desired_height + 2 end |
#render ⇒ Object
336 337 338 339 340 341 342 |
# File 'lib/ruby_rich/app_shell.rb', line 336 def render sync_component_dimensions panel = Panel.new(rendered_content, title: @title, border_style: @theme.panel_border(focused: @focused.call), title_align: :left) panel.width = @width panel.height = @height panel.render end |