Module: UI
- Defined in:
- lib/uiux.rb
Overview
Renamed UIUX module to just UI for simplicity of calling it
Class Method Summary collapse
-
.error(message) ⇒ Object
Rename to fail one in the gem.
- .execute(command) ⇒ Object
- .execute_and_register(command) ⇒ Object
- .heading(message) ⇒ Object
- .message(message) ⇒ Object
- .start(message, &block) ⇒ Object
- .time(time = Time.now.utc) ⇒ Object
Class Method Details
.error(message) ⇒ Object
Rename to fail one in the gem
25 26 27 |
# File 'lib/uiux.rb', line 25 def self.error() # Rename to fail one in the gem fail "ERROR: #{}".color(:red) end |
.execute(command) ⇒ Object
29 30 31 32 |
# File 'lib/uiux.rb', line 29 def self.execute(command) puts "#{'==>'.color(:blue)} #{command.bright}" system command end |
.execute_and_register(command) ⇒ Object
34 35 36 37 38 |
# File 'lib/uiux.rb', line 34 def self.execute_and_register(command) puts "#{'==>'.color(:blue)} #{command.bright}" puts result = `#{command}` result end |
.heading(message) ⇒ Object
17 18 19 |
# File 'lib/uiux.rb', line 17 def self.heading() puts "\n#{}".color(:green) end |
.message(message) ⇒ Object
21 22 23 |
# File 'lib/uiux.rb', line 21 def self.() puts "#{}".color(:white) end |
.start(message, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/uiux.rb', line 7 def self.start(, &block) @start_time = Time.now.utc start_heading() yield block finished rescue Exception => error puts heading_with_columns("\nFailed after #{time_from_start}", '↓', time).color(:red) raise error end |
.time(time = Time.now.utc) ⇒ Object
40 41 42 |
# File 'lib/uiux.rb', line 40 def self.time(time = Time.now.utc) "🕑 #{time} 🕑 ".color(:white) end |