Module: Salt::Api::Events
- Included in:
- Salt::Api
- Defined in:
- lib/salt/api/events.rb
Instance Method Summary collapse
Instance Method Details
#events(&block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/salt/api/events.rb', line 6 def events(&block) buffer = "" raw_events do |data| buffer += data while buffer.match("\n") event, buffer = buffer.split("\n", 2) if event.start_with? "data: " yield(JSON.parse(event.split("data: ", 2).last)) end end end end |