Class: NattyUI::Element
- Inherits:
-
Object
- Object
- NattyUI::Element
- Includes:
- Features
- Defined in:
- lib/natty-ui/element.rb
Overview
Base element class supporting all Features.
User Interaction collapse
-
#await(yes: 'Enter', no: 'Esc') ⇒ Object
included
from Features
Wait for user input.
-
#choice(*choices, abortable: false, selected: nil, **kwchoices, &block) ⇒ Object
included
from Features
Allows the user to select an option from a selection.
-
#options(abortable: false, selected: nil, **choices) {|temp| ... } ⇒ {#to_s => [true,false]}?
included
from Features
Allows the user to select from several options.
-
#select(*choices, abortable: false, selected: nil) {|temp| ... } ⇒ Array<#to_s>?
included
from Features
Allows the user to select from several options.
Printing Methods collapse
-
#cols(*columns, **attributes) {|row| ... } ⇒ Features
included
from Features
Print text in columns.
-
#div(*text, **attributes) ⇒ Features
included
from Features
Print a text division with attributes.
-
#h1(*text) ⇒ Features
included
from Features
Print given text as a H1 Features#heading.
-
#h2(*text) ⇒ Features
included
from Features
Print given text as a H2 Features#heading.
-
#h3(*text) ⇒ Features
included
from Features
Print given text as a H3 Features#heading.
-
#h4(*text) ⇒ Features
included
from Features
Print given text as a H4 Features#heading.
-
#h5(*text) ⇒ Features
included
from Features
Print given text as a H5 Features#heading.
-
#h6(*text) ⇒ Features
included
from Features
Print given text as a H6 Features#heading.
-
#hbars(values, with_values: true, normalize: false, width: :auto, style: nil, text_style: nil) ⇒ Features
included
from Features
Dump given values as horizontal bars.
-
#heading(level, *text) ⇒ Features
included
from Features
Print given text as a heading.
-
#hr(type = :default) ⇒ Features
included
from Features
Print a horizontal rule.
-
#ls(*items, compact: true, glyph: nil) ⇒ Features
included
from Features
Print given items as list (like 'ls' command).
-
#mark(*text, mark: :default, **options) ⇒ Features
included
from Features
Print given text with a decoration mark.
-
#pin(*text, mark: nil, **options) ⇒ Features
included
from Features
Print given text as lines like #puts.
-
#progress(title, max: nil, pin: false, &block) ⇒ Object
included
from Features
Dynamically display a task progress.
-
#quote(*text) ⇒ Features
included
from Features
Print given text as a quotation.
-
#space(count = 1) ⇒ Features
included
from Features
Print one or more space lines.
-
#table(**attributes) {|table| ... } ⇒ Features
included
from Features
Generate and print a table.
-
#vbars(values, normalize: false, height: 10, bar_width: :auto, style: nil) ⇒ Features
included
from Features
Dump given values as vertical bars.
Sub-Elements collapse
-
#error(title, *text) {|section| ... } ⇒ Object
(also: #err)
included
from Features
Create a visually separated section marked as an error with a title for the output of text elements.
-
#failed(title, *text) {|section| ... } ⇒ Object
included
from Features
Create a visually separated section marked as a failure with a title for the output of text elements.
-
#framed(*text, align: :left, border: :default, border_style: nil) {|frame| ... } ⇒ Object
included
from Features
Create a framed section.
-
#information(title, *text) {|section| ... } ⇒ Object
(also: #info)
included
from Features
Create a visually separated section marked as informational with a title for the output of text elements.
-
#message(title, *text) {|section| ... } ⇒ Object
(also: #msg)
included
from Features
Create a visually separated section with a title for the output of text elements.
-
#section(*text) {|section| ... } ⇒ Object
included
from Features
Create a visually separated section for the output of text elements.
-
#task(title, *text, pin: false) {|task| ... } ⇒ Object
included
from Features
Generate a task section.
-
#warning(title, *text) {|section| ... } ⇒ Object
(also: #warn)
included
from Features
Create a visually separated section marked as a warning with a title for the output of text elements.
Utilities collapse
-
#temporary {|temp| ... } ⇒ Object
included
from Features
Display some temporary content.
Instance Method Details
#await(yes: 'Enter', no: 'Esc') ⇒ true, false #await(yes: 'Enter', no: 'Esc') {|temp| ... } ⇒ true, false Originally defined in module Features
Wait for user input.
#choice(*choices, abortable: false) ⇒ Integer? #choice(*choices, abortable: false) {|temp| ... } ⇒ Integer? #choice(**choices, abortable: false) ⇒ Object? #choice(**choices, abortable: false) {|temp| ... } ⇒ Object? Originally defined in module Features
Allows the user to select an option from a selection. The selected option is returned.
#cols(*columns, **attributes) {|row| ... } ⇒ Features Originally defined in module Features
Print text in columns. This is a shorthand to define a Table with a single row.
#div(*text, **attributes) ⇒ Features Originally defined in module Features
Print a text division with attributes. This is a shorthand to define a Table with a single cell.
#error(title, *text) {|section| ... } ⇒ Object Also known as: err Originally defined in module Features
Create a visually separated section marked as an error with a title for the output of text elements.
#failed(title, *text) {|section| ... } ⇒ Object Originally defined in module Features
Create a visually separated section marked as a failure with a title for the output of text elements.
#framed(*text, align: :left, border: :default, border_style: nil) {|frame| ... } ⇒ Object Originally defined in module Features
Create a framed section.
#hbars(values, with_values: true, normalize: false, width: :auto, style: nil, text_style: nil) ⇒ Features Originally defined in module Features
Dump given values as horizontal bars.
#information(title, *text) {|section| ... } ⇒ Object Also known as: info Originally defined in module Features
Create a visually separated section marked as informational with a title for the output of text elements.
#ls(*items, compact: true, glyph: nil) ⇒ Features Originally defined in module Features
Print given items as list (like 'ls' command).
Each list item will optionally be decorated with the given glyph as:
Integer
as the start value for a numbered listSymbol
as the start symbol:hex
to create a hexadecimal numbered list- any text as prefix
#mark(*text, mark: :default, **options) ⇒ Features Originally defined in module Features
Print given text with a decoration mark.
#message(title, *text) {|section| ... } ⇒ Object Also known as: msg Originally defined in module Features
Create a visually separated section with a title for the output of text elements.
#options(abortable: false, selected: nil, **choices) {|temp| ... } ⇒ {#to_s => [true,false]}? Originally defined in module Features
Allows the user to select from several options. All options are returned with their selection status.
#progress(title, max: nil, pin: false) ⇒ ProgressHelper #progress(title, max: nil, pin: false) {|progress| ... } ⇒ Object Originally defined in module Features
Dynamically display a task progress.
When a max
parameter is given the progress will be displayed as a
progress bar below the title
. Otherwise the progress is displayed just
by accumulating dots.
#section(*text) {|section| ... } ⇒ Object Originally defined in module Features
Create a visually separated section for the output of text elements. Like any other Element sections support all NattyUI::Features.
#select(*choices, abortable: false, selected: nil) {|temp| ... } ⇒ Array<#to_s>? Originally defined in module Features
Allows the user to select from several options. The selected options are returned.
#table(**attributes) {|table| ... } ⇒ Features Originally defined in module Features
Generate and print a table. See Table for much more details about table generation.
#task(title, *text, pin: false) {|task| ... } ⇒ Object Originally defined in module Features
Generate a task section.
#temporary {|temp| ... } ⇒ Object Originally defined in module Features
Display some temporary content. The content displayed in the block will be erased after the block ends.
#vbars(values, normalize: false, height: 10, bar_width: :auto, style: nil) ⇒ Features Originally defined in module Features
Dump given values as vertical bars.
#warning(title, *text) {|section| ... } ⇒ Object Also known as: warn Originally defined in module Features
Create a visually separated section marked as a warning with a title for the output of text elements.