class Lugg::Streamer
The Streamer
reads in content from an IO object and returns an Enumerator yielding {Request} objects.
Attributes
io[R]
Public Class Methods
new(io)
click to toggle source
# File lib/lugg/streamer.rb, line 11 def initialize(io) @io = io end
Public Instance Methods
records()
click to toggle source
@return [Enumerator]
# File lib/lugg/streamer.rb, line 16 def records # rubocop:disable MethodLength Enumerator.new do |yielder| buffer = '' matcher = RequestMatcher.new io.each do |line| buffer << line if matcher =~ line if matcher.finished? yielder << Request.new(buffer) matcher = RequestMatcher.new buffer = '' end end end end