Class: HTTP::Protocol::HTTP2::Priority

Inherits:
Struct
  • Object
show all
Defined in:
lib/http/protocol/http2/priority_frame.rb

Constant Summary collapse

FORMAT =
"NC".freeze
EXCLUSIVE =
1 << 31

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exclusiveObject

Returns the value of attribute exclusive

Returns:

  • (Object)

    the current value of exclusive



26
27
28
# File 'lib/http/protocol/http2/priority_frame.rb', line 26

def exclusive
  @exclusive
end

#stream_dependencyObject

Returns the value of attribute stream_dependency

Returns:

  • (Object)

    the current value of stream_dependency



26
27
28
# File 'lib/http/protocol/http2/priority_frame.rb', line 26

def stream_dependency
  @stream_dependency
end

#weightObject

Returns the value of attribute weight

Returns:

  • (Object)

    the current value of weight



26
27
28
# File 'lib/http/protocol/http2/priority_frame.rb', line 26

def weight
  @weight
end

Class Method Details

.unpack(data) ⇒ Object



30
31
32
33
34
# File 'lib/http/protocol/http2/priority_frame.rb', line 30

def self.unpack(data)
	stream_dependency, weight = data.unpack(FORMAT)
	
	return self.new(stream_dependency & EXCLUSIVE != 0, stream_dependency & ~EXCLUSIVE, weight)
end

Instance Method Details

#packObject



36
37
38
39
40
41
42
# File 'lib/http/protocol/http2/priority_frame.rb', line 36

def pack
	if exclusive
		stream_dependency = self.stream_dependency | EXCLUSIVE
	end
	
	return [stream_dependency, self.weight].pack(FORMAT)
end