class Date
The date header represents the date and time at which the message was originated.
This header is typically included in HTTP responses and follows the format defined in RFC 9110.
Definitions
def self.parse(value)
Parses a raw header value.
Signature
-
parameter
valueString a raw header value.
-
returns
Date a new instance.
Implementation
def self.parse(value)
self.new(value)
end
def self.coerce(value)
Coerces a value into a parsed header object.
Signature
-
parameter
valueString the value to coerce.
-
returns
Date a parsed header object.
Implementation
def self.coerce(value)
self.new(value.to_s)
end
def <<(value)
Replaces the current value of the date header.
Signature
-
parameter
valueString a raw header value for the
dateheader.
Implementation
def << value
replace(value)
end
def to_time
Converts the date header value to a Time object.
Signature
-
returns
Time the parsed time object corresponding to the
dateheader value.
Implementation
def to_time
::Time.parse(self)
end
def self.trailer?
Whether this header is acceptable in HTTP trailers. Date headers can safely appear in trailers as they provide metadata about response generation.
Signature
-
returns
Boolean true, as date headers are metadata that can be computed after response generation.
Implementation
def self.trailer?
true
end