Sha256: 87fea64ae544fb1a95c3567b3d5ab17aace5298764c13a51793253dc52b79447
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
module Notifier module TerminalNotifier extend self def supported? Notifier.os?(/darwin/) && `which terminal-notifier` && $? == 0 end def notify(options) command = [ "terminal-notifier", "-group", "notifier-rubygems", "-title", options[:title].to_s, "-appIcon", options.fetch(:image, "").to_s, "-message", options[:message].to_s, "-subtitle", options.fetch(:subtitle, "").to_s ] # -sound with an empty string (e.g., "") will trigger the # default sound so we need to check for it. command.concat(["-sound", options.fetch(:sound, "default").to_s] ) if options[:sound] Thread.new { system(*command) }.join end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notifier-0.5.2 | lib/notifier/terminal_notifier.rb |