Sha256: ffe24dde84799c62d4c3115d137c86e407c8623d1679620a925cd6b8c68db530

Contents?: true

Size: 659 Bytes

Versions: 19

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

19 entries across 19 versions & 1 rubygems

Version Path
protocol-http-0.36.0 lib/protocol/http/header/connection.rb
protocol-http-0.35.0 lib/protocol/http/header/connection.rb
protocol-http-0.34.0 lib/protocol/http/header/connection.rb
protocol-http-0.33.0 lib/protocol/http/header/connection.rb
protocol-http-0.32.0 lib/protocol/http/header/connection.rb
protocol-http-0.31.0 lib/protocol/http/header/connection.rb
protocol-http-0.30.0 lib/protocol/http/header/connection.rb
protocol-http-0.29.0 lib/protocol/http/header/connection.rb
protocol-http-0.28.2 lib/protocol/http/header/connection.rb
protocol-http-0.28.1 lib/protocol/http/header/connection.rb
protocol-http-0.28.0 lib/protocol/http/header/connection.rb
protocol-http-0.27.0 lib/protocol/http/header/connection.rb
protocol-http-0.26.8 lib/protocol/http/header/connection.rb
protocol-http-0.26.7 lib/protocol/http/header/connection.rb
protocol-http-0.26.6 lib/protocol/http/header/connection.rb
protocol-http-0.26.5 lib/protocol/http/header/connection.rb
protocol-http-0.26.4 lib/protocol/http/header/connection.rb
protocol-http-0.26.3 lib/protocol/http/header/connection.rb
protocol-http-0.26.2 lib/protocol/http/header/connection.rb