Module: Fatty::StatusApi
- Included in:
- CallbackEnvironment
- Defined in:
- lib/fatty/api/status.rb
Overview
Public API convenience methods for use by the library user
Instance Method Summary collapse
-
#error(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "oops," i.e., a soft failure.
-
#good(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "good," i.e., success.
-
#info(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "info".
- #oops(text, replace: false, render: true) ⇒ Object
-
#status(text, role: :info, replace: false, render: true) ⇒ Object
Display text in the status area with the given "role", which determines the coloring of the displayed text via themeing.
-
#warn(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "warn," i.e., short of an error but not complete success either.
Instance Method Details
#error(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "oops," i.e., a soft failure.
47 48 49 |
# File 'lib/fatty/api/status.rb', line 47 def error(text, replace: false, render: true) status(text, role: :error, replace:, render:) end |
#good(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "good," i.e., success.
28 29 30 |
# File 'lib/fatty/api/status.rb', line 28 def good(text, replace: false, render: true) status(text, role: :good, replace:, render:) end |
#info(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "info".
34 35 36 |
# File 'lib/fatty/api/status.rb', line 34 def info(text, replace: false, render: true) status(text, role: :info, replace:, render:) end |
#oops(text, replace: false, render: true) ⇒ Object
51 52 53 |
# File 'lib/fatty/api/status.rb', line 51 def oops(text, replace: false, render: true) status(text, role: :error, replace:, render:) end |
#status(text, role: :info, replace: false, render: true) ⇒ Object
Display text in the status area with the given "role", which determines the coloring of the displayed text via themeing.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fatty/api/status.rb', line 10 def status(text, role: :info, replace: false, render: true) terminal.apply_command( Command.session( :status, :show, text: text, role: role, append: !replace, ) ) terminal.without_cursor_restore do terminal.render_frame end if render nil end |
#warn(text, replace: false, render: true) ⇒ Object
Display a message to the user in the status line, colored according to the Config for "warn," i.e., short of an error but not complete success either.
41 42 43 |
# File 'lib/fatty/api/status.rb', line 41 def warn(text, replace: false, render: true) status(text, role: :warn, replace:, render:) end |