Class: SoundNotifier
- Inherits:
-
Object
- Object
- SoundNotifier
- Defined in:
- lib/sound_notifier.rb
Overview
SoundNotifier library for notiffany
Defined Under Namespace
Classes: UnsupportedPlatform
Constant Summary collapse
- DATA_PATH =
File.('../../data', __FILE__)
- VERSION =
'0.1.2'.freeze
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type) ⇒ SoundNotifier
constructor
A new instance of SoundNotifier.
- #kernel ⇒ Object
- #notify ⇒ Object
Constructor Details
#initialize(type) ⇒ SoundNotifier
Returns a new instance of SoundNotifier.
26 27 28 29 |
# File 'lib/sound_notifier.rb', line 26 def initialize(type) @type = type check_host_supported end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
18 19 20 |
# File 'lib/sound_notifier.rb', line 18 def type @type end |
Class Method Details
.execute(type = :notify) ⇒ Object
21 22 23 |
# File 'lib/sound_notifier.rb', line 21 def execute(type = :notify) new(type).notify end |
Instance Method Details
#kernel ⇒ Object
31 32 33 |
# File 'lib/sound_notifier.rb', line 31 def kernel @kernel ||= Kernel end |
#notify ⇒ Object
35 36 37 38 |
# File 'lib/sound_notifier.rb', line 35 def notify return unless File.exist?(sound_file) && play_command @sound_thread = Thread.new { play_file } end |