Class: Clacky::RichTodoSidebar
- Inherits:
-
Object
- Object
- Clacky::RichTodoSidebar
- Defined in:
- lib/clacky/rich_ui_controller.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #add_task(label, status: :pending) ⇒ Object
-
#initialize(tasks: []) ⇒ RichTodoSidebar
constructor
A new instance of RichTodoSidebar.
- #render ⇒ Object
- #set_tasks(tasks) ⇒ Object
- #update_plan(_text) ⇒ Object
Constructor Details
#initialize(tasks: []) ⇒ RichTodoSidebar
Returns a new instance of RichTodoSidebar.
327 328 329 330 331 |
# File 'lib/clacky/rich_ui_controller.rb', line 327 def initialize(tasks: []) @tasks = tasks @width = 0 @height = 0 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
324 325 326 |
# File 'lib/clacky/rich_ui_controller.rb', line 324 def height @height end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
325 326 327 |
# File 'lib/clacky/rich_ui_controller.rb', line 325 def tasks @tasks end |
#width ⇒ Object
Returns the value of attribute width.
324 325 326 |
# File 'lib/clacky/rich_ui_controller.rb', line 324 def width @width end |
Instance Method Details
#add_task(label, status: :pending) ⇒ Object
342 343 344 345 |
# File 'lib/clacky/rich_ui_controller.rb', line 342 def add_task(label, status: :pending) @tasks << { label: label, status: status } self end |
#render ⇒ Object
347 348 349 350 351 352 |
# File 'lib/clacky/rich_ui_controller.rb', line 347 def render panel = RubyRich::Panel.new(render_tasks, title: "Todos", border_style: :blue, title_align: :left) panel.width = @width panel.height = @height panel.render end |
#set_tasks(tasks) ⇒ Object
337 338 339 340 |
# File 'lib/clacky/rich_ui_controller.rb', line 337 def set_tasks(tasks) @tasks = Array(tasks) self end |
#update_plan(_text) ⇒ Object
333 334 335 |
# File 'lib/clacky/rich_ui_controller.rb', line 333 def update_plan(_text) self end |