Class: Rubtella::TCPData::Builder::Query

Inherits:
Rubtella::TCPData::Builder show all
Defined in:
lib/rubtella/tcp_data.rb

Constant Summary

Constants included from Config

Config::GUID, Config::IP_ADDRESS, Config::PID_FILE, Config::PORT

Instance Attribute Summary

Attributes inherited from Rubtella::TCPData::Base

#binary_data, #guid, #hops, #messages, #messages_codes, #payload_lenght, #payload_type, #rest, #ttl

Instance Method Summary collapse

Methods inherited from Rubtella::TCPData::Builder

#build, #init_messages_codes

Methods included from Config

generate_guid

Constructor Details

#initialize(args = nil) ⇒ Query

Returns a new instance of Query.



105
106
107
108
109
110
111
112
113
# File 'lib/rubtella/tcp_data.rb', line 105

def initialize args = nil

  super()

  @payload_type = @messages_codes["query"]
  @speed = 0
  @criteria = args.is_a?(Hash) ? args[:criteria] : ""

end

Instance Method Details

#build_messageObject



115
116
117
# File 'lib/rubtella/tcp_data.rb', line 115

def build_message
  @payload = [@speed, @criteria.unpack("C*")]
end