Sha256: f8630d1ea7b349661f6e5dbb317dac204a33abdaec4cb0ed2fdc86d64625d0b7

Contents?: true

Size: 659 Bytes

Versions: 8

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2024, by Samuel Williams.
# Copyright, 2024, by Thomas Morgan.

require_relative "split"

module Protocol
	module HTTP
		module Header
			class Connection < Split
				KEEP_ALIVE = "keep-alive"
				CLOSE = "close"
				UPGRADE = "upgrade"
				
				def initialize(value = nil)
					super(value&.downcase)
				end
				
				def << value
					super(value.downcase)
				end
				
				def keep_alive?
					self.include?(KEEP_ALIVE) && !close?
				end
				
				def close?
					self.include?(CLOSE)
				end
				
				def upgrade?
					self.include?(UPGRADE)
				end
			end
		end
	end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
protocol-http-0.44.0 lib/protocol/http/header/connection.rb
protocol-http-0.43.0 lib/protocol/http/header/connection.rb
protocol-http-0.42.0 lib/protocol/http/header/connection.rb
protocol-http-0.41.0 lib/protocol/http/header/connection.rb
protocol-http-0.40.0 lib/protocol/http/header/connection.rb
protocol-http-0.39.0 lib/protocol/http/header/connection.rb
protocol-http-0.38.0 lib/protocol/http/header/connection.rb
protocol-http-0.37.0 lib/protocol/http/header/connection.rb