Class: NattyUI::Task

Inherits:
Temporary show all
Defined in:
lib/natty-ui/task.rb

Overview

A Temporary element that represents a single labelled step.

Instances are created by Features#task. Any content printed inside a Task block disappears when the element is closed. Content printed with Features#pin is exempt — it is collected and reprinted after the erasure so it remains visible.

All Features methods are available on this element, making it easy to nest sub-tasks or progress indicators inside a task block.

Examples:

Simple task with a block

ui.task 'Installing dependencies' do
  run_install
end

Nested tasks

ui.task 'Deploy' do
  ui.task('Build') { compile }
  ui.task('Upload') { upload }
  ui.pin 'Deployed to production', mark: :checkmark
end