Class: DiscourseTheme::UI
- Inherits:
-
Object
- Object
- DiscourseTheme::UI
- Defined in:
- lib/discourse_theme/ui.rb
Constant Summary collapse
- @@prompt =
::TTY::Prompt.new(help_color: :cyan)
- @@pastel =
Pastel.new
Class Method Summary collapse
- .ask(message, default: nil) ⇒ Object
- .error(message) ⇒ Object
- .info(message) ⇒ Object
- .progress(message) ⇒ Object
- .select(message, options) ⇒ Object
- .success(message) ⇒ Object
- .warn(message) ⇒ Object
- .yes?(message) ⇒ Boolean
Class Method Details
.ask(message, default: nil) ⇒ Object
11 12 13 |
# File 'lib/discourse_theme/ui.rb', line 11 def self.ask(, default: nil) @@prompt.ask(@@pastel.cyan("? ") + , default: default) end |
.error(message) ⇒ Object
27 28 29 |
# File 'lib/discourse_theme/ui.rb', line 27 def self.error() puts @@pastel.red("✘ #{}") end |
.info(message) ⇒ Object
19 20 21 |
# File 'lib/discourse_theme/ui.rb', line 19 def self.info() puts @@pastel.blue("i ") + end |
.progress(message) ⇒ Object
23 24 25 |
# File 'lib/discourse_theme/ui.rb', line 23 def self.progress() puts @@pastel.yellow("» ") + end |
.select(message, options) ⇒ Object
15 16 17 |
# File 'lib/discourse_theme/ui.rb', line 15 def self.select(, ) @@prompt.select(@@pastel.cyan("? ") + , ) end |
.success(message) ⇒ Object
35 36 37 |
# File 'lib/discourse_theme/ui.rb', line 35 def self.success() puts @@pastel.green("✔ #{}") end |
.warn(message) ⇒ Object
31 32 33 |
# File 'lib/discourse_theme/ui.rb', line 31 def self.warn() puts @@pastel.yellow("⚠ #{}") end |
.yes?(message) ⇒ Boolean
7 8 9 |
# File 'lib/discourse_theme/ui.rb', line 7 def self.yes?() @@prompt.yes?(@@pastel.cyan("? ") + ) end |