Sha256: bafa5e35f1fe2ce96ddf3fb3c94d6f824a4cfab2b53f53114bf15890b483c5e9
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
class NotifySend COMMAND = 'notify-send' def message(text) @message = text self end def title(text) @title = text self end def image(icon) @icon = icon self end def urgency(level) @urgency = level.to_s self end def expire_time(time) @expire_time = time self end def hint(values) @hint = values.collect.each { |element| element.to_s}.join(':') self end def to_s command = COMMAND.clone [:hint, :priority, :icon, :urgency].each do |option| variable = instance_variable_get("@#{option}") command << " --#{option}=#{variable}" if variable end command << " --expire-time=#{@expire_time}" if @expire_time [:title, :message].each do |option| variable = instance_variable_get("@#{option}") command << " '#{variable}'" if variable end command end # Extract this to a module or something def notify! system(to_s) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notifiers-1.2.0 | lib/notifiers/notify_send.rb |