Class: Net::IMAP::ResponseReader

Inherits:
Object
  • Object
show all
Defined in:
lib/net/imap/response_reader.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, sock) ⇒ ResponseReader

Returns a new instance of ResponseReader.



9
10
11
12
13
14
15
# File 'lib/net/imap/response_reader.rb', line 9

def initialize(client, sock)
  @client, @sock = client, sock
  # cached config
  @max_response_size = nil
  # response buffer state
  @buff = @literal_size = nil
end

Instance Attribute Details

#clientObject (readonly)

:nodoc:



7
8
9
# File 'lib/net/imap/response_reader.rb', line 7

def client
  @client
end

Instance Method Details

#read_response_bufferObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/net/imap/response_reader.rb', line 17

def read_response_buffer
  @max_response_size = client.max_response_size
  @buff = String.new
  catch :eof do
    while true
      guard_response_too_large!
      read_line
      # check before allocating memory for literal
      guard_response_too_large!
      break unless literal_size
      read_literal
    end
  end
  buff
ensure
  @buff = @literal_size = nil
end