Module: UI

Defined in:
lib/uiux.rb

Overview

Renamed UIUX module to just UI for simplicity of calling it

Class Method Summary collapse

Class Method Details

.error(message) ⇒ Object

Rename to fail one in the gem



24
25
26
# File 'lib/uiux.rb', line 24

def self.error(message) # Rename to fail one in the gem
  fail "ERROR: #{message}".color(:red)
end

.execute(command) ⇒ Object



28
29
30
31
32
# File 'lib/uiux.rb', line 28

def self.execute(command)
  puts "#{'==>'.color(:blue)} #{command.bright}"
  puts result = `#{command}`
  result
end

.heading(message) ⇒ Object



16
17
18
# File 'lib/uiux.rb', line 16

def self.heading(message)
  puts "\n#{message}".color(:green)
end

.message(message) ⇒ Object



20
21
22
# File 'lib/uiux.rb', line 20

def self.message(message)
  puts "#{message}".color(:white)
end

.start(message, &block) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/uiux.rb', line 7

def self.start(message, &block)
  start_heading message
  yield block
  finished
rescue Exception => error
  puts heading_with_columns("\nFailed", '↓', time).color(:red)
  raise error
end

.timeObject



34
35
36
# File 'lib/uiux.rb', line 34

def self.time
  "🕑  #{Time.now.utc} 🕑 ".color(:white)
end