Module: Termline::Msg
- Defined in:
- lib/termline/msg.rb
Class Method Summary collapse
- .alert(message) ⇒ Object
- .builder(message, tag: nil, icon: nil, color: :default, bgcolor: :default, timestamp: Time.now.strftime('%H:%M:%S:%L'), time: true, data: nil) ⇒ Object
Class Method Details
.alert(message) ⇒ Object
57 58 59 60 |
# File 'lib/termline/msg.rb', line 57 def alert puts("\e[5m#{}\e[0m") puts("\e[5m#{Style.colorize(,:red)}\e[0m") end |
.builder(message, tag: nil, icon: nil, color: :default, bgcolor: :default, timestamp: Time.now.strftime('%H:%M:%S:%L'), time: true, data: nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/termline/msg.rb', line 37 def builder( , tag: nil, icon: nil, color: :default, bgcolor: :default, timestamp: Time.now.strftime('%H:%M:%S:%L'), time:true, data:nil) parts = [] parts << "[#{}]" if time parts << Style.colorize(Style.icon(icon), color) if icon parts << Style.colorize(tag, color) if tag parts << parts << data_text(data, color) if data parts.compact.map(&:to_s).reject(&:empty?).join(" ").strip end |