6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby で Growl に通知するサンプル

Posted at

ruby-growl を使って通知するためのスクリプト。こんな感じ

rgrowl-test.rb
# ! /usr/local/ruby200/bin/ruby
# coding: utf-8
#
require 'ruby-growl'

g = Growl::GNTP.new "localhost", "ruby-growl"
g.add_notification "notification", "ruby-growl Notification",
                     URI.parse('https://gravatar.com/avatar/d203ebd5ab7bc53ae59327780edc19b3')
g.notify "notification", "Ruby スクリプトからの通知",
          "ruby-growl を使ったテストメッセージです。", 0, true, nil, 'http://www.asahi.com'

exit 0

ググると Growl.new するサンプルが多いけど、それだと callbacks の URL 指定が怒られてしまうので Growl::GNTP を使いました。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?