Module: Webbed::GenericMessage Abstract

Included in:
Request, Response
Defined in:
lib/webbed/generic_message.rb

Overview

This module is abstract.

Include and implement #status_line.

Generic methods used for both Request's and Response's.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entity_body#to_s

The Entity Body of the message.

Returns:



33
34
35
# File 'lib/webbed/generic_message.rb', line 33

def entity_body
  @entity_body
end

#headersHeaders

The Headers of the message.

The method automatically converts the new value to an instance of Headers if it is not already one.

Returns:



24
25
26
# File 'lib/webbed/generic_message.rb', line 24

def headers
  @headers
end

#http_versionHTTPVersion

The HTTP-Version of the message.

The method automatically converts the new value to an instance of HTTPVersion if it is not already one.

Returns:



12
13
14
# File 'lib/webbed/generic_message.rb', line 12

def http_version
  @http_version
end

Instance Method Details

#to_sString

Converts the message into an HTTP Message as per RFC 2616.

Returns:

  • (String)


38
39
40
# File 'lib/webbed/generic_message.rb', line 38

def to_s
  "#{start_line}#{headers.to_s}\r\n#{entity_body}"
end