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.



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

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

.debug(message) ⇒ Object

Logs the message in cyan color.



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

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

.loggerObject

Logger used to log all the messages.



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

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

.success(message) ⇒ Object

Logs the message in green color.



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

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

.warn(message) ⇒ Object

Logs the message in yellow color.



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

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