Class: HTTP::Features::AutoDeflate::GzippedBody::BlockIO

Inherits:
Object
  • Object
show all
Defined in:
lib/http/features/auto_deflate.rb

Overview

IO adapter that delegates writes to a block

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ BlockIO

Initializes a block-based IO adapter

Examples:

BlockIO.new(block)

Parameters:

  • block (Proc)


191
192
193
# File 'lib/http/features/auto_deflate.rb', line 191

def initialize(block)
  @block = block
end

Instance Method Details

#write(data) ⇒ Object

Writes data by calling the block

Examples:

block_io.write("data")

Parameters:

  • data (String)

Returns:

  • (Object)


203
204
205
# File 'lib/http/features/auto_deflate.rb', line 203

def write(data)
  @block.call(data)
end