Module: Notifyor::Growl

Extended by:
Growl
Included in:
Growl
Defined in:
lib/notifyor/growl.rb,
lib/notifyor/growl/adapters/terminal_notifier.rb,
lib/notifyor/growl/adapters/libnotify_notifier.rb

Defined Under Namespace

Modules: Adapters

Instance Method Summary collapse

Instance Method Details

#adapterObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/notifyor/growl.rb', line 6

def adapter
  return @adapter if @adapter
  self.adapter =
      case ::Notifyor::Util::OSAnalyzer.os
        when :macosx
          :terminal_notifier
        when :linux
          :libnotify_notifier
        when :unix
          :libnotify_notifier
        else
          raise 'Operating system not recognized.'
      end
  @adapter
end

#adapter=(adapter_name) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/notifyor/growl.rb', line 22

def adapter=(adapter_name)
  case adapter_name
    when Symbol, String
      require "notifyor/growl/adapters/#{adapter_name}"
      @adapter = Notifyor::Growl::Adapters.const_get("#{adapter_name.to_s.split('_').collect(&:capitalize).join}")
    else
      raise "Missing adapter #{adapter_name}"
  end
end

#create_growl(title, message) ⇒ Object



32
33
34
# File 'lib/notifyor/growl.rb', line 32

def create_growl(title, message)
  adapter.create_growl(title, message)
end