Class: Protocol::HTTP2::Priority

Inherits:
Struct
  • Object
show all
Defined in:
lib/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



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

def exclusive
  @exclusive
end

#stream_dependencyObject

Returns the value of attribute stream_dependency

Returns:

  • (Object)

    the current value of stream_dependency



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

def stream_dependency
  @stream_dependency
end

#weightObject

Returns the value of attribute weight

Returns:

  • (Object)

    the current value of weight



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

def weight
  @weight
end

Class Method Details

.unpack(data) ⇒ Object



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

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



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

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