Module: Hologram::DisplayMessage

Defined in:
lib/hologram/display_message.rb

Constant Summary collapse

@@quiet =
false

Class Method Summary collapse

Class Method Details

.angry_table_flipperObject



54
55
56
# File 'lib/hologram/display_message.rb', line 54

def self.angry_table_flipper
  green("(\u{256F}\u{00B0}\u{25A1}\u{00B0}\u{FF09}\u{256F}") + red("\u{FE35} \u{253B}\u{2501}\u{253B} ")
end

.colorize(color_code, str) ⇒ Object

colorization



59
60
61
# File 'lib/hologram/display_message.rb', line 59

def self.colorize(color_code, str)
  "\e[#{color_code}m#{str}\e[0m"
end

.created(files) ⇒ Object



39
40
41
42
43
44
# File 'lib/hologram/display_message.rb', line 39

def self.created(files)
  puts "Created the following files and directories:"
  files.each do |file_name|
    puts "  #{file_name}"
  end
end

.error(message) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/hologram/display_message.rb', line 28

def self.error(message)
  if RUBY_VERSION.to_f > 1.8 then
    puts angry_table_flipper + red(" Build not complete.")
  else
    puts red("Build not complete.")
  end

  puts " #{message}"
  exit 1
end

.green(str) ⇒ Object



67
68
69
# File 'lib/hologram/display_message.rb', line 67

def self.green(str)
  colorize(32, str)
end

.info(message) ⇒ Object



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

def self.info(message)
  puts message
end

.pink(str) ⇒ Object



75
76
77
# File 'lib/hologram/display_message.rb', line 75

def self.pink(str)
  colorize(35, str)
end

.puts(str) ⇒ Object



19
20
21
22
# File 'lib/hologram/display_message.rb', line 19

def self.puts(str)
  return if quiet?
  super(str)
end

.quiet!Object



5
6
7
8
# File 'lib/hologram/display_message.rb', line 5

def self.quiet!
  @@quiet = true
  return self
end

.quiet?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/hologram/display_message.rb', line 15

def self.quiet?
  @@quiet
end

.red(str) ⇒ Object



63
64
65
# File 'lib/hologram/display_message.rb', line 63

def self.red(str)
  colorize(31, str)
end

.show!Object



10
11
12
13
# File 'lib/hologram/display_message.rb', line 10

def self.show!
  @@quiet = false
  return self
end

.success(message) ⇒ Object



50
51
52
# File 'lib/hologram/display_message.rb', line 50

def self.success(message)
  puts green(message)
end

.warning(message) ⇒ Object



46
47
48
# File 'lib/hologram/display_message.rb', line 46

def self.warning(message)
  puts yellow("Warning: #{message}")
end

.yellow(str) ⇒ Object



71
72
73
# File 'lib/hologram/display_message.rb', line 71

def self.yellow(str)
  colorize(33, str)
end