Class: Biryani::Frame::Ping
- Inherits:
-
Object
- Object
- Biryani::Frame::Ping
- Defined in:
- lib/biryani/frame/ping.rb
Instance Attribute Summary collapse
-
#f_type ⇒ Object
readonly
Returns the value of attribute f_type.
-
#opaque ⇒ Object
readonly
Returns the value of attribute opaque.
-
#stream_id ⇒ Object
readonly
Returns the value of attribute stream_id.
Class Method Summary collapse
Instance Method Summary collapse
- #ack? ⇒ Boolean
-
#initialize(ack, stream_id, opaque) ⇒ Ping
constructor
A new instance of Ping.
- #length ⇒ Integer
- #to_binary_s ⇒ String
Constructor Details
Instance Attribute Details
#f_type ⇒ Object (readonly)
Returns the value of attribute f_type.
4 5 6 |
# File 'lib/biryani/frame/ping.rb', line 4 def f_type @f_type end |
#opaque ⇒ Object (readonly)
Returns the value of attribute opaque.
4 5 6 |
# File 'lib/biryani/frame/ping.rb', line 4 def opaque @opaque end |
#stream_id ⇒ Object (readonly)
Returns the value of attribute stream_id.
4 5 6 |
# File 'lib/biryani/frame/ping.rb', line 4 def stream_id @stream_id end |
Class Method Details
.read(s, flags, stream_id) ⇒ Ping
39 40 41 42 43 44 |
# File 'lib/biryani/frame/ping.rb', line 39 def self.read(s, flags, stream_id) return ConnectionError.new(ErrorCode::FRAME_SIZE_ERROR, 'PING payload length MUST be 8') if s.bytesize != 8 ack = Frame.read_ack(flags) Ping.new(ack, stream_id, s) end |
Instance Method Details
#ack? ⇒ Boolean
17 18 19 |
# File 'lib/biryani/frame/ping.rb', line 17 def ack? @ack end |
#length ⇒ Integer
22 23 24 |
# File 'lib/biryani/frame/ping.rb', line 22 def length 8 end |
#to_binary_s ⇒ String
27 28 29 30 31 32 |
# File 'lib/biryani/frame/ping.rb', line 27 def to_binary_s payload_length = length flags = Frame.to_flags(ack: ack?) Frame.to_binary_s_header(payload_length, @f_type, flags, @stream_id) + opaque end |