Module: M2R::Base

Included in:
Request
Defined in:
lib/m2r/request/base.rb

Overview

Logic for typical Mongrel2 request with no fancy features such as async upload

Instance Method Summary collapse

Instance Method Details

#body_ioStringIO

Returns Request body encapsulated in IO compatible object.

Returns:

  • (StringIO)

    Request body encapsulated in IO compatible object



9
10
11
12
13
14
15
# File 'lib/m2r/request/base.rb', line 9

def body_io
  @body_io ||= begin
    b = StringIO.new(body)
    b.set_encoding(Encoding::BINARY) if b.respond_to?(:set_encoding)
    b
  end
end

#free!nil

Returns Free external resources such as files or sockets.

Returns:

  • (nil)

    Free external resources such as files or sockets



19
20
21
# File 'lib/m2r/request/base.rb', line 19

def free!
  body_io.close
end