Class: Protocol::HTTP::Header::Date

Inherits:
String
  • Object
show all
Defined in:
lib/protocol/http/header/date.rb

Overview

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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.trailer?Boolean

Whether this header is acceptable in HTTP trailers. Date headers can safely appear in trailers as they provide metadata about response generation.

Returns:

  • (Boolean)


32
33
34
# File 'lib/protocol/http/header/date.rb', line 32

def self.trailer?
  true
end

Instance Method Details

#<<(value) ⇒ Object

Replaces the current value of the ‘date` header with the specified value.



18
19
20
# File 'lib/protocol/http/header/date.rb', line 18

def << value
  replace(value)
end

#to_timeObject

Converts the ‘date` header value to a `Time` object.



25
26
27
# File 'lib/protocol/http/header/date.rb', line 25

def to_time
  ::Time.parse(self)
end