Class: Cadre::Libnotify::Notifier
- Inherits:
-
Object
- Object
- Cadre::Libnotify::Notifier
- Defined in:
- lib/cadre/libnotify/notifier.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#expire_time ⇒ Object
Returns the value of attribute expire_time.
-
#message ⇒ Object
Returns the value of attribute message.
-
#sound ⇒ Object
Returns the value of attribute sound.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#transient ⇒ Object
Returns the value of attribute transient.
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize {|_self| ... } ⇒ Notifier
constructor
A new instance of Notifier.
- #options ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Notifier
Returns a new instance of Notifier.
6 7 8 |
# File 'lib/cadre/libnotify/notifier.rb', line 6 def initialize yield self if block_given? end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
10 11 12 |
# File 'lib/cadre/libnotify/notifier.rb', line 10 def app_name @app_name end |
#expire_time ⇒ Object
Returns the value of attribute expire_time.
10 11 12 |
# File 'lib/cadre/libnotify/notifier.rb', line 10 def expire_time @expire_time end |
#message ⇒ Object
Returns the value of attribute message.
10 11 12 |
# File 'lib/cadre/libnotify/notifier.rb', line 10 def end |
#sound ⇒ Object
Returns the value of attribute sound.
10 11 12 |
# File 'lib/cadre/libnotify/notifier.rb', line 10 def sound @sound end |
#summary ⇒ Object
Returns the value of attribute summary.
10 11 12 |
# File 'lib/cadre/libnotify/notifier.rb', line 10 def summary @summary end |
#transient ⇒ Object
Returns the value of attribute transient.
10 11 12 |
# File 'lib/cadre/libnotify/notifier.rb', line 10 def transient @transient end |
Instance Method Details
#go ⇒ Object
12 13 14 15 16 |
# File 'lib/cadre/libnotify/notifier.rb', line 12 def go cmd = "notify-send #{options} \"#@summary\" \"#@message\"" %x[#{cmd}] %x[paplay #{Valise.find(["sounds", sound]).full_path}] if String === sound end |
#options ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cadre/libnotify/notifier.rb', line 18 def = [] unless expire_time.nil? << "-t #@expire_time" end if transient << "-h \"byte:transient:1\"" end unless app_name.nil? << "-a #@app_name" end .join(" ") end |