Class: Notiffany::Notifier::Tmux::Notification
- Inherits:
-
Object
- Object
- Notiffany::Notifier::Tmux::Notification
- Defined in:
- lib/notiffany/notifier/tmux/notification.rb
Overview
Wraps a notification with it’s options
Instance Method Summary collapse
- #colorize(locations) ⇒ Object
- #display_message(title, message) ⇒ Object
- #display_title(title, message) ⇒ Object
-
#initialize(type, options) ⇒ Notification
constructor
A new instance of Notification.
Constructor Details
#initialize(type, options) ⇒ Notification
Returns a new instance of Notification.
6 7 8 9 10 11 12 13 |
# File 'lib/notiffany/notifier/tmux/notification.rb', line 6 def initialize(type, ) @type = type @options = @color = [type.to_sym] || [:default] @separator = [:line_separator] @message_color = _value_for(:message_color) @client = Client.new([:display_on_all_clients] ? :all : nil) end |
Instance Method Details
#colorize(locations) ⇒ Object
33 34 35 36 37 |
# File 'lib/notiffany/notifier/tmux/notification.rb', line 33 def colorize(locations) locations.each do |location| client.set(location, color) end end |
#display_message(title, message) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/notiffany/notifier/tmux/notification.rb', line 24 def (title, ) = (title, ) client.display_time = [:timeout] * 1000 client. = client. = color client.() end |
#display_title(title, message) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/notiffany/notifier/tmux/notification.rb', line 15 def display_title(title, ) title_format = _value_for(:title_format) = .split("\n").first display_title = format(title_format, title, ) client.title = display_title end |