Class: CheckList::Helpers
- Inherits:
-
Object
- Object
- CheckList::Helpers
- Defined in:
- lib/helpers.rb
Overview
Class to build the selection menu
Class Method Summary collapse
- .bg_green ⇒ Object
- .bg_red ⇒ Object
- .bg_white ⇒ Object
- .bg_yellow ⇒ Object
- .check_status(status) ⇒ Object
- .clear ⇒ Object
- .good_bye ⇒ Object
- .green ⇒ Object
- .leave ⇒ Object
- .log(str) ⇒ Object
- .red ⇒ Object
- .ret_value ⇒ Object
- .system_cmd(cmd) ⇒ Object
- .white ⇒ Object
- .write_json_file(data_hash) ⇒ Object
- .yellow ⇒ Object
Class Method Details
.bg_green ⇒ Object
51 52 53 |
# File 'lib/helpers.rb', line 51 def self.bg_green "\x1b[42m" end |
.bg_red ⇒ Object
47 48 49 |
# File 'lib/helpers.rb', line 47 def self.bg_red "\x1b[41m" end |
.bg_white ⇒ Object
59 60 61 |
# File 'lib/helpers.rb', line 59 def self.bg_white "\x1b[47m" end |
.bg_yellow ⇒ Object
55 56 57 |
# File 'lib/helpers.rb', line 55 def self.bg_yellow "\x1b[43m" end |
.check_status(status) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/helpers.rb', line 12 def self.check_status(status) case status.downcase when 'y' "#{green}Complete#{white}" when 'n' "#{red}Not Complete#{white}" when 'na' "#{yellow}Not Applicable#{white}" end end |
.clear ⇒ Object
23 24 25 |
# File 'lib/helpers.rb', line 23 def self.clear system 'clear' end |
.good_bye ⇒ Object
6 7 8 9 10 |
# File 'lib/helpers.rb', line 6 def self.good_bye clear log 'Good Bye' leave end |
.green ⇒ Object
67 68 69 |
# File 'lib/helpers.rb', line 67 def self.green "\x1b[32m" end |
.leave ⇒ Object
35 36 37 |
# File 'lib/helpers.rb', line 35 def self.leave exit end |
.log(str) ⇒ Object
27 28 29 |
# File 'lib/helpers.rb', line 27 def self.log(str) puts str end |
.red ⇒ Object
63 64 65 |
# File 'lib/helpers.rb', line 63 def self.red "\x1b[31m" end |
.ret_value ⇒ Object
31 32 33 |
# File 'lib/helpers.rb', line 31 def self.ret_value $stdin.gets.chomp end |
.system_cmd(cmd) ⇒ Object
39 40 41 |
# File 'lib/helpers.rb', line 39 def self.system_cmd(cmd) `#{cmd}` end |
.white ⇒ Object
75 76 77 |
# File 'lib/helpers.rb', line 75 def self.white "\x1b[37m" end |
.write_json_file(data_hash) ⇒ Object
43 44 45 |
# File 'lib/helpers.rb', line 43 def self.write_json_file(data_hash) File.write('./checklist/data.json', JSON.pretty_generate(data_hash)) end |
.yellow ⇒ Object
71 72 73 |
# File 'lib/helpers.rb', line 71 def self.yellow "\x1b[33m" end |