Class: Guard::FayeNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/luca.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ FayeNotifier

Returns a new instance of FayeNotifier.



60
61
62
# File 'lib/guard/luca.rb', line 60

def initialize url 
  @url = url
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



58
59
60
# File 'lib/guard/luca.rb', line 58

def client
  @client
end

#urlObject (readonly)

Returns the value of attribute url.



58
59
60
# File 'lib/guard/luca.rb', line 58

def url
  @url
end

Instance Method Details

#publish(channel, message) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/guard/luca.rb', line 72

def publish channel, message
  EM.run do
    UI.info "Publishing To #{ url }"
    client = ::Faye::Client.new(url)
    pub    = client.publish( channel, message )
    pub.callback { EM.stop }
    pub.errback { EM.stop }
  end
end

#shutdownObject



68
69
70
# File 'lib/guard/luca.rb', line 68

def shutdown
  EM.stop
end