Class: KuberKit::UI::Simple
Defined Under Namespace
Instance Method Summary collapse
- #create_task(title, &block) ⇒ Object
- #create_task_group ⇒ Object
- #print_error(title, text) ⇒ Object
- #print_info(title, text) ⇒ Object
- #print_warning(title, text) ⇒ Object
- #prompt(text, options, &callback) ⇒ Object
Instance Method Details
#create_task(title, &block) ⇒ Object
53 54 55 56 57 |
# File 'lib/kuber_kit/ui/simple.rb', line 53 def create_task(title, &block) task = Task.new(title, &block) task.execute task.wait end |
#create_task_group ⇒ Object
49 50 51 |
# File 'lib/kuber_kit/ui/simple.rb', line 49 def create_task_group TaskGroup.new end |
#print_error(title, text) ⇒ Object
63 64 65 |
# File 'lib/kuber_kit/ui/simple.rb', line 63 def print_error(title, text) print_text(title, text, color: String::Colors::RED) end |
#print_info(title, text) ⇒ Object
59 60 61 |
# File 'lib/kuber_kit/ui/simple.rb', line 59 def print_info(title, text) print_text(title, text, color: String::Colors::BLUE) end |
#print_warning(title, text) ⇒ Object
67 68 69 |
# File 'lib/kuber_kit/ui/simple.rb', line 67 def print_warning(title, text) print_text(title, text, color: String::Colors::YELLOW) end |
#prompt(text, options, &callback) ⇒ Object
71 72 73 74 75 |
# File 'lib/kuber_kit/ui/simple.rb', line 71 def prompt(text, , &callback) print_info("Select", text) result = $stdin.gets.chomp callback.call(result) end |