class Head
Represents a body suitable for HEAD requests, in other words, a body that is empty and has a known length.
Definitions
def self.for(body)
Create a head body for the given body, capturing it's length and then closing it.
Implementation
def self.for(body)
head = self.new(body.length)
body.close
return head
end
def initialize(length)
Initialize the head body with the given length.
Signature
-
parameter
length
Integer
the length of the body.
Implementation
def initialize(length)
@length = length
end
def empty?
Signature
-
returns
Boolean
the body is empty.
Implementation
def empty?
true
end
def ready?
Signature
-
returns
Boolean
the body is ready.
Implementation
def ready?
true
end
def length
Signature
-
returns
Integer
the length of the body, if known.
Implementation
def length
@length
end