Class: Hypertube::Core::Receiver::Receiver

Inherits:
Object
  • Object
show all
Defined in:
lib/hypertube-ruby-sdk/core/receiver/receiver.rb

Class Method Summary collapse

Class Method Details

.get_runtime_infoObject



37
38
39
# File 'lib/hypertube-ruby-sdk/core/receiver/receiver.rb', line 37

def self.get_runtime_info
  Hypertube::Utils::RuntimeLogger.get_runtime_info(true)
end

.heart_beat(message_array) ⇒ Object



32
33
34
35
# File 'lib/hypertube-ruby-sdk/core/receiver/receiver.rb', line 32

def self.heart_beat(message_array)
  response_array = [message_array[11], message_array[12] - 2]
  [response_array.length, response_array]
end

.send_command(message_array) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/hypertube-ruby-sdk/core/receiver/receiver.rb', line 12

def self.send_command(message_array)
  begin
    response_array = Hypertube::Core::Protocol::CommandSerializer.serialize(Hypertube::Core::Interpreter::Interpreter.process(message_array))
  rescue Exception => e
    message = "Error occurred in Hypertube::Sdk::RuntimeBridge Ruby Core: #{e.message}"
    puts message
    exception_command = Hypertube::Utils::Command.new(Hypertube::Utils::RuntimeNameHt::RUBY, Hypertube::Utils::CommandType::EXCEPTION, [])
    exception_command = exception_command.add_arg_to_payload(Hypertube::Utils::Exceptions::ExceptionType::EXCEPTION)
    exception_command = exception_command.add_arg_to_payload(Hypertube::Utils::Command.new(Hypertube::Utils::RuntimeNameHt::RUBY, Hypertube::Utils::CommandType::EXCEPTION, ["Ruby Core Error", "Ruby Core Error"]).to_s)
    exception_command = exception_command.add_arg_to_payload("Ruby Core Error")
    exception_command = exception_command.add_arg_to_payload(e.message)
    exception_command = exception_command.add_arg_to_payload("Hypertube::Core::Receiver::Receiver")
    exception_command = exception_command.add_arg_to_payload("send_command")
    exception_command = exception_command.add_arg_to_payload("undefined")
    exception_command = exception_command.add_arg_to_payload(__FILE__)
    response_array = Hypertube::Core::Protocol::CommandSerializer.serialize(exception_command)
  end
  [response_array.length, response_array]
end