Class: RSpec::SSE::Matchers::SseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/sse/matchers.rb

Class Method Summary collapse

Class Method Details

.parse(body) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/rspec/sse/matchers.rb', line 162

def self.parse(body)
  events = []
  EventStreamParser::Parser.new.feed(body) do |type, data, id, reconnection_time|
    events << {
      type:,
      data:,
      id:,
      retry: reconnection_time
    }
  end
  events
end