Module: Announce
- Defined in:
- lib/terminal-announce.rb
Class Method Summary collapse
- .color_for(type) ⇒ Object
- .failure(message) ⇒ Object
- .info(message) ⇒ Object
- .log(type, message) ⇒ Object
- .prefix_for(type) ⇒ Object
- .success(message) ⇒ Object
- .warning(message) ⇒ Object
Class Method Details
.color_for(type) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/terminal-announce.rb', line 4 def self.color_for(type) { success: :green, failure: :red, warning: :yellow, info: :cyan }[type] end |
.failure(message) ⇒ Object
23 24 25 |
# File 'lib/terminal-announce.rb', line 23 def self.failure() log :failure, end |
.info(message) ⇒ Object
31 32 33 |
# File 'lib/terminal-announce.rb', line 31 def self.info() log :info, end |
.log(type, message) ⇒ Object
35 36 37 |
# File 'lib/terminal-announce.rb', line 35 def self.log(type, ) puts "#{prefix_for type} #{}" end |
.prefix_for(type) ⇒ Object
13 14 15 16 17 |
# File 'lib/terminal-announce.rb', line 13 def self.prefix_for(type) color = color_for type text = type.to_s.capitalize "[#{Rainbow(text).color(color)}]" end |
.success(message) ⇒ Object
19 20 21 |
# File 'lib/terminal-announce.rb', line 19 def self.success() log :success, end |
.warning(message) ⇒ Object
27 28 29 |
# File 'lib/terminal-announce.rb', line 27 def self.warning() log :warning, end |