Class: Chef::HTTP::ValidateContentLength::ContentLengthCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/http/validate_content_length.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContentLengthCounter

Returns a new instance of ContentLengthCounter.



34
35
36
# File 'lib/chef/http/validate_content_length.rb', line 34

def initialize
  @content_length = 0
end

Instance Attribute Details

#content_lengthObject

Returns the value of attribute content_length.



32
33
34
# File 'lib/chef/http/validate_content_length.rb', line 32

def content_length
  @content_length
end

Instance Method Details

#handle_chunk(chunk) ⇒ Object



38
39
40
41
# File 'lib/chef/http/validate_content_length.rb', line 38

def handle_chunk(chunk)
  @content_length += chunk.bytesize
  chunk
end