Class: Cadre::Notifier
- Inherits:
-
Object
- Object
- Cadre::Notifier
- Defined in:
- lib/cadre/notifier.rb
Direct Known Subclasses
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.
Class Method Summary collapse
Instance Method Summary collapse
- #available?(program) ⇒ Boolean
- #go ⇒ Object
-
#initialize {|_self| ... } ⇒ Notifier
constructor
A new instance of Notifier.
Constructor Details
#initialize {|_self| ... } ⇒ Notifier
Returns a new instance of Notifier.
29 30 31 |
# File 'lib/cadre/notifier.rb', line 29 def initialize yield self if block_given? end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
33 34 35 |
# File 'lib/cadre/notifier.rb', line 33 def app_name @app_name end |
#expire_time ⇒ Object
Returns the value of attribute expire_time.
33 34 35 |
# File 'lib/cadre/notifier.rb', line 33 def expire_time @expire_time end |
#message ⇒ Object
Returns the value of attribute message.
33 34 35 |
# File 'lib/cadre/notifier.rb', line 33 def @message end |
#sound ⇒ Object
Returns the value of attribute sound.
33 34 35 |
# File 'lib/cadre/notifier.rb', line 33 def sound @sound end |
#summary ⇒ Object
Returns the value of attribute summary.
33 34 35 |
# File 'lib/cadre/notifier.rb', line 33 def summary @summary end |
#transient ⇒ Object
Returns the value of attribute transient.
33 34 35 |
# File 'lib/cadre/notifier.rb', line 33 def transient @transient end |
Class Method Details
.availables ⇒ Object
20 21 22 |
# File 'lib/cadre/notifier.rb', line 20 def availables @availables ||= Hash.new{|h,k| h[k] = system("which", k, :out => "/dev/null")} end |
.get ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/cadre/notifier.rb', line 12 def get registry.each_pair do |name, notifier| return notifier if notifier.available? end return DumbNotifier end |
.register(name) ⇒ Object
8 9 10 |
# File 'lib/cadre/notifier.rb', line 8 def register(name) Notifier.registry[name] = self end |
.registry ⇒ Object
4 5 6 |
# File 'lib/cadre/notifier.rb', line 4 def registry @registry ||= {} end |
Instance Method Details
#available?(program) ⇒ Boolean
25 26 27 |
# File 'lib/cadre/notifier.rb', line 25 def available?(program) self.class.availables[program] end |
#go ⇒ Object
35 36 |
# File 'lib/cadre/notifier.rb', line 35 def go end |