Module: PDQTest::Emoji

Defined in:
lib/pdqtest/emoji.rb

Constant Summary collapse

@@disable =
false

Class Method Summary collapse

Class Method Details

.disable(disable) ⇒ Object



5
6
7
# File 'lib/pdqtest/emoji.rb', line 5

def self.disable(disable)
  @@disable = disable
end

.emoji_message(emoji, message) ⇒ Object

Print a message prefixed with optional emoji to the STDOUT logger



10
11
12
13
14
15
# File 'lib/pdqtest/emoji.rb', line 10

def self.emoji_message(emoji, message)
  if ! @@disable
    message = "#{message} #{emoji}"
  end
  Escort::Logger.output.puts message
end

.emoji_status(status, emoji_pass, emoji_fail, label) ⇒ Object

print cool emoji based on status



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pdqtest/emoji.rb', line 18

def self.emoji_status(status, emoji_pass, emoji_fail, label)
  lable_string = "#{label}: "
  if ! @@disable
    if status
      # cool bananas
      Escort::Logger.output.puts lable_string + emoji_pass
    else
      # boom! crappy code
      Escort::Logger.error.error lable_string + emoji_fail
    end
  end
end

.final_status(status) ⇒ Object

Overall program exit status



37
38
39
# File 'lib/pdqtest/emoji.rb', line 37

def self.final_status(status)
  emoji_status(status, "😎", "💩", 'Overall')
end

.partial_status(status, label) ⇒ Object

partial status when lots to do



32
33
34
# File 'lib/pdqtest/emoji.rb', line 32

def self.partial_status(status, label)
  emoji_status(status, "😬", "💣", label)
end