class Rubiclifier::Notification

Attributes

icon[R]
message[R]
subtitle[R]
title[R]
url[R]

Public Class Methods

new(title, message, subtitle = nil, icon = nil, url = nil) click to toggle source
# File lib/notification.rb, line 8
def initialize(title, message, subtitle = nil, icon = nil, url = nil)
  Feature.fail_unless_enabled(Feature::NOTIFICATIONS)
  @title = title
  @message = message
  @subtitle = subtitle
  @icon = icon
  @url = url
end

Public Instance Methods

send() click to toggle source
# File lib/notification.rb, line 17
def send
  args = {
    "title" => title,
    "message" => message,
    "subtitle" => subtitle,
    "appIcon" => icon,
    "open" => url
  }
  all_args = args.keys.reduce("") do |arg_string, key|
    if args[key]
      arg_string += " -#{key} '#{args[key]}'"
    end
    arg_string
  end
  system("/usr/local/bin/terminal-notifier #{all_args}")
end