Sha256: e08dcec80cfc2aed290b836799b38dea044ab73810dea14813c57ffe9b818333

Contents?: true

Size: 611 Bytes

Versions: 9

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2023, by Samuel Williams.

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)
				end
				
				def close?
					self.include?(CLOSE)
				end
				
				def upgrade?
					self.include?(UPGRADE)
				end
			end
		end
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
protocol-http-0.25.0 lib/protocol/http/header/connection.rb
protocol-http-0.24.7 lib/protocol/http/header/connection.rb
protocol-http-0.24.6 lib/protocol/http/header/connection.rb
protocol-http-0.24.5 lib/protocol/http/header/connection.rb
protocol-http-0.24.4 lib/protocol/http/header/connection.rb
protocol-http-0.24.3 lib/protocol/http/header/connection.rb
protocol-http-0.24.2 lib/protocol/http/header/connection.rb
protocol-http-0.24.1 lib/protocol/http/header/connection.rb
protocol-http-0.24.0 lib/protocol/http/header/connection.rb