Class: Monitorer
- Inherits:
-
Object
- Object
- Monitorer
- Defined in:
- lib/monitorer.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Monitorer
constructor
A new instance of Monitorer.
- #notify(event) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Monitorer
Returns a new instance of Monitorer.
33 34 35 36 |
# File 'lib/monitorer.rb', line 33 def initialize(opts={}) @channel = EventMachine::Channel.new EventMachine.start_server opts[:host], opts[:port], MonitorConnection, self end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
23 24 25 |
# File 'lib/monitorer.rb', line 23 def channel @channel end |
Class Method Details
.notify(event) ⇒ Object
29 30 31 |
# File 'lib/monitorer.rb', line 29 def self.notify(event) current.notify(event) if current end |
Instance Method Details
#notify(event) ⇒ Object
38 39 40 |
# File 'lib/monitorer.rb', line 38 def notify(event) @channel.push JSON.dump(event) end |