Class: Guard::FayeNotifier
- Inherits:
-
Object
- Object
- Guard::FayeNotifier
- Defined in:
- lib/guard/luca.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ FayeNotifier
constructor
A new instance of FayeNotifier.
- #publish(channel, message) ⇒ Object
- #shutdown ⇒ Object
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
#client ⇒ Object (readonly)
Returns the value of attribute client.
58 59 60 |
# File 'lib/guard/luca.rb', line 58 def client @client end |
#url ⇒ Object (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, EM.run do UI.info "Publishing To #{ url }" client = ::Faye::Client.new(url) pub = client.publish( channel, ) pub.callback { EM.stop } pub.errback { EM.stop } end end |
#shutdown ⇒ Object
68 69 70 |
# File 'lib/guard/luca.rb', line 68 def shutdown EM.stop end |