Class: NattyUI::Section

Inherits:
Element show all
Defined in:
lib/natty-ui/section.rb

Overview

An Element that draws a bordered container with an optional title.

Instances are created by Features#section and its typed shorthand variants: Features#message, Features#information, Features#warning, Features#error, and Features#fatal. The visual style (border colour, prefix mark) is determined by the type: argument.

All Features methods are available on this element.

Examples:

Via block (auto-close)

ui.section 'Summary', type: :information do
  ui.puts '3 files processed.'
end

Manual close

sec = ui.warning 'Disk space low'
ui.puts 'Only 500 MB remaining.'
sec.end