Module: Nsnotify
- Defined in:
- lib/nsnotify/version.rb,
lib/nsnotify/nsnotify.rb
Constant Summary collapse
- VERSION =
"0.0.4"- ICONS =
File.('../icons', __FILE__)
- TERMINAL_NOTIFICATION_BIN =
File.join(vendor, 'terminal-notifier_v1.0/terminal-notifier.app/Contents/MacOS/terminal-notifier')
Class Attribute Summary collapse
-
.app_bundle_identifier ⇒ Object
Returns the value of attribute app_bundle_identifier.
-
.app_name ⇒ Object
Returns the value of attribute app_name.
-
.use ⇒ Object
(also: use?)
Returns the value of attribute use.
Class Method Summary collapse
-
.notify(title, message) ⇒ Object
Calls the notification service.
-
.usable? ⇒ Boolean
Determines whether you are running OS X 10.8 or later, which is the minimum required for the Notification Center.
Class Attribute Details
.app_bundle_identifier ⇒ Object
Returns the value of attribute app_bundle_identifier.
7 8 9 |
# File 'lib/nsnotify/nsnotify.rb', line 7 def app_bundle_identifier @app_bundle_identifier end |
.app_name ⇒ Object
Returns the value of attribute app_name.
7 8 9 |
# File 'lib/nsnotify/nsnotify.rb', line 7 def app_name @app_name end |
.use ⇒ Object Also known as: use?
Returns the value of attribute use.
7 8 9 |
# File 'lib/nsnotify/nsnotify.rb', line 7 def use @use end |
Class Method Details
.notify(title, message) ⇒ Object
Calls the notification service.
Parameters
- title<String>
-
the title of the notification
- message<String>
-
the actual message
Example
Nsnotify.notify "Testing!", "Can you see me?!"
50 51 52 53 |
# File 'lib/nsnotify/nsnotify.rb', line 50 def notify(title, ) throw "This gem needs OSX 10.8 Mountain Lion to work!" if not usable? `'#{TERMINAL_NOTIFICATION_BIN}' #{Dir.pwd} '#{title}' '#{}' '#{app_bundle_identifier}'` end |
.usable? ⇒ Boolean
Determines whether you are running OS X 10.8 or later, which is the minimum required for the Notification Center.
13 14 15 |
# File 'lib/nsnotify/nsnotify.rb', line 13 def usable? @usable ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8' end |