Class: Htcp::Message::Header
Instance Attribute Summary collapse
-
#payload_len ⇒ Object
Returns the value of attribute payload_len.
Instance Method Summary collapse
-
#initialize(params) ⇒ Header
constructor
A new instance of Header.
- #to_s ⇒ Object
Methods inherited from Base
#encode_int16, #encode_int32, #encode_int8, #encode_string
Constructor Details
#initialize(params) ⇒ Header
Returns a new instance of Header.
6 7 8 9 10 11 12 13 |
# File 'lib/htcp/message/header.rb', line 6 def initialize(params) @params = { :major => 0, :minor => 0 }.merge(params) @payload_len = 0 end |
Instance Attribute Details
#payload_len ⇒ Object
Returns the value of attribute payload_len.
4 5 6 |
# File 'lib/htcp/message/header.rb', line 4 def payload_len @payload_len end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/htcp/message/header.rb', line 15 def to_s encode_int16(@payload_len + 4) + encode_int8(@params[:major], @params[:minor]) end |