Module: Tamarillo::Notification

Defined in:
lib/tamarillo/notification.rb,
lib/tamarillo/notification/bell.rb,
lib/tamarillo/notification/none.rb,
lib/tamarillo/notification/growl.rb,
lib/tamarillo/notification/touch.rb,
lib/tamarillo/notification/speech.rb

Defined Under Namespace

Classes: Bell, Growl, None, Speech, Touch

Constant Summary collapse

BELL =
:bell.freeze
GROWL =
:growl.freeze
NONE =
:none.freeze
SPEECH =
:speech.freeze
VALID =
[BELL, GROWL, NONE, SPEECH]

Class Method Summary collapse

Class Method Details

.defaultObject



22
23
24
# File 'lib/tamarillo/notification.rb', line 22

def self.default
  BELL
end

.for(type) ⇒ Object

Public: Resolves a notification class.



27
28
29
30
31
32
33
34
# File 'lib/tamarillo/notification.rb', line 27

def self.for(type)
  case type
  when BELL then Bell.new
  when GROWL then Growl.new
  when SPEECH then Speech.new
  else None.new
  end
end

.valid!(value) ⇒ Object

Public: Returns a valid notification type.



17
18
19
20
# File 'lib/tamarillo/notification.rb', line 17

def self.valid!(value)
  value = value.to_s.downcase.to_sym
  VALID.include?(value) ? value : nil
end