Module: TreasureData::API::CountReadBodyTotalSize
- Defined in:
- lib/td/client/api.rb
Instance Attribute Summary collapse
-
#total_fragment_size ⇒ Object
readonly
Returns the value of attribute total_fragment_size.
Instance Method Summary collapse
Instance Attribute Details
#total_fragment_size ⇒ Object (readonly)
Returns the value of attribute total_fragment_size.
266 267 268 |
# File 'lib/td/client/api.rb', line 266 def total_fragment_size @total_fragment_size end |
Instance Method Details
#read_body(&block) ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/td/client/api.rb', line 268 def read_body(&block) return super if @total_fragment_size if block_given? @total_fragment_size = 0 super {|fragment| @total_fragment_size += fragment.size block.call(fragment) } else super().tap {|body| @total_fragment_size = body.size } end end |