Class: GRPCWeb::MessageFrame
- Inherits:
-
Object
- Object
- GRPCWeb::MessageFrame
- Defined in:
- lib/grpc_web/message_frame.rb
Overview
Placeholder
Constant Summary collapse
- PAYLOAD_FRAME_TYPE =
String: “x00”
0
- HEADER_FRAME_TYPE =
String: “x80”
128
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#frame_type ⇒ Object
Returns the value of attribute frame_type.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #header? ⇒ Boolean
-
#initialize(frame_type, body) ⇒ MessageFrame
constructor
A new instance of MessageFrame.
- #payload? ⇒ Boolean
Constructor Details
#initialize(frame_type, body) ⇒ MessageFrame
Returns a new instance of MessageFrame.
18 19 20 21 |
# File 'lib/grpc_web/message_frame.rb', line 18 def initialize(frame_type, body) self.frame_type = frame_type self.body = body.b # treat body as a byte string end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
16 17 18 |
# File 'lib/grpc_web/message_frame.rb', line 16 def body @body end |
#frame_type ⇒ Object
Returns the value of attribute frame_type.
16 17 18 |
# File 'lib/grpc_web/message_frame.rb', line 16 def frame_type @frame_type end |
Class Method Details
.header_frame(body) ⇒ Object
12 13 14 |
# File 'lib/grpc_web/message_frame.rb', line 12 def self.header_frame(body) new(HEADER_FRAME_TYPE, body) end |
.payload_frame(body) ⇒ Object
8 9 10 |
# File 'lib/grpc_web/message_frame.rb', line 8 def self.payload_frame(body) new(PAYLOAD_FRAME_TYPE, body) end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 |
# File 'lib/grpc_web/message_frame.rb', line 31 def ==(other) frame_type == other.frame_type && body == other.body end |
#header? ⇒ Boolean
27 28 29 |
# File 'lib/grpc_web/message_frame.rb', line 27 def header? frame_type == HEADER_FRAME_TYPE end |
#payload? ⇒ Boolean
23 24 25 |
# File 'lib/grpc_web/message_frame.rb', line 23 def payload? frame_type == PAYLOAD_FRAME_TYPE end |