Class: Ansible::SSE
- Inherits:
-
Object
- Object
- Ansible::SSE
- Defined in:
- lib/ansible/sse.rb
Instance Attribute Summary collapse
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(stream) ⇒ SSE
constructor
A new instance of SSE.
- #write(event, message) ⇒ Object
Constructor Details
#initialize(stream) ⇒ SSE
Returns a new instance of SSE.
7 8 9 |
# File 'lib/ansible/sse.rb', line 7 def initialize(stream) @stream = stream end |
Instance Attribute Details
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
5 6 7 |
# File 'lib/ansible/sse.rb', line 5 def stream @stream end |
Instance Method Details
#close ⇒ Object
17 18 19 |
# File 'lib/ansible/sse.rb', line 17 def close stream.close end |
#write(event, message) ⇒ Object
11 12 13 14 15 |
# File 'lib/ansible/sse.rb', line 11 def write(event, ) stream.write "event: #{event}\n" stream.write "retry: 1000\n" stream.write "data: #{JSON.dump }\n\n" end |