class Miyuki::Notifier

Public Class Methods

new(notifier = nil) click to toggle source
# File lib/miyuki/notifier.rb, line 17
def initialize(notifier = nil)
  @notifier = notifier || get_notifier
end

Public Instance Methods

has_notifier?() click to toggle source
# File lib/miyuki/notifier.rb, line 25
def has_notifier?
  !!@notifier
end
notify(title, message) click to toggle source
# File lib/miyuki/notifier.rb, line 21
def notify(title, message)
  @notifier.notify(title, message) if has_notifier?
end

Private Instance Methods

get_notifier() click to toggle source
# File lib/miyuki/notifier.rb, line 31
def get_notifier
  case RUBY_PLATFORM
    when /darwin/ then Miyuki::TerminalNotifier.new
    when /linux/  then Miyuki::Libnotify.new
    when /mswin|msys|mingw|cygwin/ then Miyuki::Notifu.new
  end
end