Class: Mistri::Sinks::ActionCable
- Inherits:
-
Object
- Object
- Mistri::Sinks::ActionCable
- Defined in:
- lib/mistri/sinks/action_cable.rb
Overview
Instance Method Summary collapse
- #call(event) ⇒ Object
-
#initialize(stream, server: nil) ⇒ ActionCable
constructor
A new instance of ActionCable.
- #to_proc ⇒ Object
Constructor Details
#initialize(stream, server: nil) ⇒ ActionCable
Returns a new instance of ActionCable.
12 13 14 15 |
# File 'lib/mistri/sinks/action_cable.rb', line 12 def initialize(stream, server: nil) @stream = stream @server = server end |
Instance Method Details
#call(event) ⇒ Object
17 18 19 |
# File 'lib/mistri/sinks/action_cable.rb', line 17 def call(event) server.broadcast(@stream, event.to_h) end |
#to_proc ⇒ Object
21 |
# File 'lib/mistri/sinks/action_cable.rb', line 21 def to_proc = method(:call).to_proc |