Skip to content

Commit

Permalink
Align examples in README and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
splattael committed May 4, 2011
1 parent ef4de0f commit 95397d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
16 changes: 8 additions & 8 deletions README.rdoc
Expand Up @@ -11,12 +11,12 @@ RDoc[http://rdoc.info/projects/splattael/libnotify]

# Block syntax
n = Libnotify.new do |notify|
notify.summary = "world"
notify.body = "hello"
notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
notify.urgency = :critical # :low, :normal, :critical
notify.append = false # default true - append onto existing notification
notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
notify.summary = "hello"
notify.body = "world"
notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
notify.urgency = :critical # :low, :normal, :critical
notify.append = false # default true - append onto existing notification
notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
end
n.show!

Expand All @@ -38,9 +38,9 @@ You'll need libnotify. On Debian just type:

== Testing

git co git://github.com/splattael/libnotify.git
git clone git://github.com/splattael/libnotify.git
cd libnotify
gem install bundler
(gem install bundler)
bundle install
rake

Expand Down
26 changes: 9 additions & 17 deletions lib/libnotify.rb
Expand Up @@ -13,14 +13,18 @@ module Libnotify
#
# @example Block syntax
# n = Libnotify.new do |notify|
# notify.summary = "world"
# notify.body = "hello"
# notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
# notify.urgency = :critical # :low, :normal, :critical
# notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
# notify.summary = "hello"
# notify.body = "world"
# notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
# notify.urgency = :critical # :low, :normal, :critical
# notify.append = false # default true - append onto existing notification
# notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
# end
# n.show!
#
# @example Hash syntax
# Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
#
# @example Mixed syntax
# Libnotify.new(options) do |n|
# n.timeout = 1.5 # overrides :timeout in options
Expand All @@ -46,18 +50,6 @@ def self.new(options={}, &block)

# Shows a notification. It takes the same +options+ as Libnotify.new.
#
# @example Block syntax
# Libnotify.show do |notify|
# notify.summary = "world"
# notify.body = "hello"
# notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
# notify.urgency = :critical # :low, :normal, :critical
# notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
# end
#
# @example Hash syntax
# Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
#
# @see Libnotify.new
def self.show(options={}, &block)
API.show(options, &block)
Expand Down

0 comments on commit 95397d8

Please sign in to comment.