Module: Hologram::DisplayMessage
- Defined in:
- lib/hologram/display_message.rb
Constant Summary collapse
- @@quiet =
false
- @@exit_on_warnings =
false
Class Method Summary collapse
- .angry_table_flipper ⇒ Object
-
.colorize(color_code, str) ⇒ Object
colorization.
- .continue_on_warnings! ⇒ Object
- .created(files) ⇒ Object
- .error(message) ⇒ Object
- .exit_on_warnings! ⇒ Object
- .green(str) ⇒ Object
- .info(message) ⇒ Object
- .pink(str) ⇒ Object
- .puts(str) ⇒ Object
- .quiet! ⇒ Object
- .quiet? ⇒ Boolean
- .red(str) ⇒ Object
- .show! ⇒ Object
- .success(message) ⇒ Object
- .warning(message) ⇒ Object
- .yellow(str) ⇒ Object
Class Method Details
.angry_table_flipper ⇒ Object
67 68 69 |
# File 'lib/hologram/display_message.rb', line 67 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
72 73 74 |
# File 'lib/hologram/display_message.rb', line 72 def self.colorize(color_code, str) "\e[#{color_code}m#{str}\e[0m" end |
.continue_on_warnings! ⇒ Object
24 25 26 |
# File 'lib/hologram/display_message.rb', line 24 def self.continue_on_warnings! @@exit_on_warnings = false end |
.created(files) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/hologram/display_message.rb', line 48 def self.created(files) puts "Created the following files and directories:" files.each do |file_name| puts " #{file_name}" end end |
.error(message) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hologram/display_message.rb', line 37 def self.error() if RUBY_VERSION.to_f > 1.8 then puts angry_table_flipper + red(" Build not complete.") else puts red("Build not complete.") end puts " #{}" exit 1 end |
.exit_on_warnings! ⇒ Object
20 21 22 |
# File 'lib/hologram/display_message.rb', line 20 def self.exit_on_warnings! @@exit_on_warnings = true end |
.green(str) ⇒ Object
80 81 82 |
# File 'lib/hologram/display_message.rb', line 80 def self.green(str) colorize(32, str) end |
.info(message) ⇒ Object
33 34 35 |
# File 'lib/hologram/display_message.rb', line 33 def self.info() puts end |
.pink(str) ⇒ Object
88 89 90 |
# File 'lib/hologram/display_message.rb', line 88 def self.pink(str) colorize(35, str) end |
.puts(str) ⇒ Object
28 29 30 31 |
# File 'lib/hologram/display_message.rb', line 28 def self.puts(str) return if quiet? super(str) end |
.quiet! ⇒ Object
6 7 8 9 |
# File 'lib/hologram/display_message.rb', line 6 def self.quiet! @@quiet = true return self end |
.quiet? ⇒ Boolean
16 17 18 |
# File 'lib/hologram/display_message.rb', line 16 def self.quiet? @@quiet end |
.red(str) ⇒ Object
76 77 78 |
# File 'lib/hologram/display_message.rb', line 76 def self.red(str) colorize(31, str) end |
.show! ⇒ Object
11 12 13 14 |
# File 'lib/hologram/display_message.rb', line 11 def self.show! @@quiet = false return self end |
.success(message) ⇒ Object
63 64 65 |
# File 'lib/hologram/display_message.rb', line 63 def self.success() puts green() end |
.warning(message) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/hologram/display_message.rb', line 55 def self.warning() puts yellow("Warning: #{}") if @@exit_on_warnings puts red("Exiting due to warning") exit 1 end end |
.yellow(str) ⇒ Object
84 85 86 |
# File 'lib/hologram/display_message.rb', line 84 def self.yellow(str) colorize(33, str) end |