lib/sse_client/sse_events.rb
# Generator that parses the input interator and returns instances of SSEEvent or SSERetryInterval.
Generator that parses the input interator and returns instances of SSEEvent or SSERetryInterval.
Generator that parses the input interator and returns instances of SSEEvent or SSERetryInterval .
def items
      Enumerator.new do |gen|
        @lines.each do |line|
          line.chomp!
          if line.empty?
            event = maybe_create_event
            reset_buffers
            gen.yield event if !event.nil?
          else
            case line
              when /^(\w+): ?(.*)$/
                item = process_field($1, $2)
                gen.yield item if !item.nil?
            end
          end
        end
      end
    end
def items Enumerator . new do | gen | @lines . each do | line | line . chomp! if line . empty? event = maybe_create_event reset_buffers gen . yield event if ! event . nil? else case line when / ^( \w +): ?(.*)$ / item = process_field ( $1 , $2 ) gen . yield item if ! item . nil? end end end end end
Generator that parses the input interator and returns instances of SSEEvent or SSERetryInterval.
Generator that parses the input interator and returns instances of SSEEvent or SSERetryInterval .