Module: UI

Defined in:
lib/arkana/helpers/ui.rb

Overview

Contains utilities related to display information to the user on the Terminal (the user’s interface).

Class Method Summary collapse

Class Method Details

.crash(message) ⇒ Object

Logs the message in red color and raise an error with the given message.



9
10
11
12
# File 'lib/arkana/helpers/ui.rb', line 9

def self.crash(message)
  logger.fatal(message.red)
  raise message
end

.debug(message) ⇒ Object

Logs the message in cyan color.



15
16
17
# File 'lib/arkana/helpers/ui.rb', line 15

def self.debug(message)
  logger.debug(message.cyan)
end

.loggerObject

Logger used to log all the messages.



30
31
32
# File 'lib/arkana/helpers/ui.rb', line 30

def self.logger
  @logger ||= Logger.new($stdout)
end

.success(message) ⇒ Object

Logs the message in green color.



20
21
22
# File 'lib/arkana/helpers/ui.rb', line 20

def self.success(message)
  logger.info(message.green)
end

.warn(message) ⇒ Object

Logs the message in yellow color.



25
26
27
# File 'lib/arkana/helpers/ui.rb', line 25

def self.warn(message)
  logger.warn(message.yellow)
end