Class: KuberKit::UI::Simple
Defined Under Namespace
Instance Method Summary collapse
- #create_task(title, &block) ⇒ Object
- #create_task_group ⇒ Object
- #print_debug(title, text) ⇒ Object
- #print_error(title, text) ⇒ Object
- #print_info(title, text) ⇒ Object
- #print_result(message, data = {}) ⇒ Object
- #print_warning(title, text) ⇒ Object
- #prompt(text, options) ⇒ Object
Instance Method Details
#create_task(title, &block) ⇒ Object
71 72 73 74 75 |
# File 'lib/kuber_kit/ui/simple.rb', line 71 def create_task(title, &block) task = Task.new(title, &block) task.execute task.wait end |
#create_task_group ⇒ Object
67 68 69 |
# File 'lib/kuber_kit/ui/simple.rb', line 67 def create_task_group TaskGroup.new(KuberKit::UI::Simple::Task) end |
#print_debug(title, text) ⇒ Object
90 91 92 |
# File 'lib/kuber_kit/ui/simple.rb', line 90 def print_debug(title, text) logger.debug(text) end |
#print_error(title, text) ⇒ Object
81 82 83 |
# File 'lib/kuber_kit/ui/simple.rb', line 81 def print_error(title, text) print_text(title, text, color: String::Colors::RED) end |
#print_info(title, text) ⇒ Object
77 78 79 |
# File 'lib/kuber_kit/ui/simple.rb', line 77 def print_info(title, text) print_text(title, text, color: String::Colors::BLUE) end |
#print_result(message, data = {}) ⇒ Object
94 95 96 97 98 |
# File 'lib/kuber_kit/ui/simple.rb', line 94 def print_result(, data = {}) print_debug("Result", "---------------------------") print_debug("Result", ) print_debug("Result", "---------------------------") end |
#print_warning(title, text) ⇒ Object
85 86 87 88 |
# File 'lib/kuber_kit/ui/simple.rb', line 85 def print_warning(title, text) print_text(title, text, color: String::Colors::YELLOW) logger.debug(text) end |
#prompt(text, options) ⇒ Object
100 101 102 103 104 |
# File 'lib/kuber_kit/ui/simple.rb', line 100 def prompt(text, ) print_info("Select", text + "(#{.join(', ')})") result = $stdin.gets.chomp result end |