Class: Integrity::Notifier::Bonjour
- Inherits:
-
Notifier::Base
- Object
- Notifier::Base
- Integrity::Notifier::Bonjour
- Defined in:
- lib/bonjour.rb
Instance Attribute Summary collapse
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
Class Method Summary collapse
Instance Method Summary collapse
- #deliver! ⇒ Object
-
#initialize(build, config = {}) ⇒ Bonjour
constructor
A new instance of Bonjour.
- #message ⇒ Object
Constructor Details
#initialize(build, config = {}) ⇒ Bonjour
Returns a new instance of Bonjour.
13 14 15 16 |
# File 'lib/bonjour.rb', line 13 def initialize(build, config={}) @recipients = config["recipients"].nil? ? [] : config.delete("recipients").split(/\s+/) super end |
Instance Attribute Details
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
7 8 9 |
# File 'lib/bonjour.rb', line 7 def recipients @recipients end |
Class Method Details
.to_haml ⇒ Object
9 10 11 |
# File 'lib/bonjour.rb', line 9 def self.to_haml File.read(File.dirname(__FILE__) / "config.haml") end |
Instance Method Details
#deliver! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bonjour.rb', line 18 def deliver! user = Ahoy::User.new("Integrity") user.sign_in sleep 1 # wait for the contact list to populate contacts = user.contacts.select{|c|@recipients.include?(c.name)} contacts.each do |contact| chat = user.chat(contact) chat.send() chat.close end user.sign_out end |
#message ⇒ Object
33 34 35 |
# File 'lib/bonjour.rb', line 33 def @message ||= commit.successful? ? : "#{} #{commit_url}" end |