Class: LLM::Provider::Transport::HTTP::StreamDecoder Private
- Inherits:
-
Object
- Object
- LLM::Provider::Transport::HTTP::StreamDecoder
- Defined in:
- lib/llm/provider/transport/http/stream_decoder.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #parser ⇒ Object readonly private
Instance Method Summary collapse
- #<<(chunk) ⇒ void private
- #body ⇒ Object private
- #free ⇒ void private
- #initialize(parser) ⇒ LLM::Provider::Transport::HTTP::StreamDecoder constructor private
Constructor Details
#initialize(parser) ⇒ LLM::Provider::Transport::HTTP::StreamDecoder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 |
# File 'lib/llm/provider/transport/http/stream_decoder.rb', line 14 def initialize(parser) @buffer = +"" @cursor = 0 @data = [] @parser = parser end |
Instance Attribute Details
#parser ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/llm/provider/transport/http/stream_decoder.rb', line 9 def parser @parser end |
Instance Method Details
#<<(chunk) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
24 25 26 27 |
# File 'lib/llm/provider/transport/http/stream_decoder.rb', line 24 def <<(chunk) @buffer << chunk each_line { handle_line(_1) } end |
#body ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/llm/provider/transport/http/stream_decoder.rb', line 31 def body parser.body end |
#free ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
37 38 39 40 41 42 |
# File 'lib/llm/provider/transport/http/stream_decoder.rb', line 37 def free @buffer.clear @cursor = 0 @data.clear parser.free if parser.respond_to?(:free) end |