lib/capistrano-notification.rb in capistrano-notification-0.0.1 vs lib/capistrano-notification.rb in capistrano-notification-0.0.2
- old
+ new
@@ -30,14 +30,16 @@
if opts[:required]
validates_presence_of name
end
end
- def initialize(vars = {})
+ def initialize(vars = {}, &block)
vars.each do |k, v|
send k, v
end
+
+ block.call(self) if block
end
validates_presence_of :name
end
@@ -59,11 +61,11 @@
def login
[user, password].compact.join(':')
end
end
- def irc(opts)
- add IRC.new(opts)
+ def irc(opts = {}, &block)
+ add IRC.new(opts, &block)
end
def add(notification)
task_name = notification.name.downcase.gsub(' ', '_')