Class: Htcp::Message::Constructor

Inherits:
Object
  • Object
show all
Defined in:
lib/htcp/message/constructor.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Constructor

Returns a new instance of Constructor.



4
5
6
7
8
# File 'lib/htcp/message/constructor.rb', line 4

def initialize(params)
  @header = Htcp::Message::Header.new(params[:head] || {})
  @data = Htcp::Message::Data.new(params[:data] || params)
  @auth = Htcp::Message::Auth.new(params[:auth] || {})
end

Instance Method Details

#to_sObject



10
11
12
13
14
# File 'lib/htcp/message/constructor.rb', line 10

def to_s
  payload = @data.to_s + @auth.to_s
  @header.payload_len = payload.length
  @header.to_s + payload
end