Class: Receiver

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

Class Method Summary collapse

Class Method Details

.get_runtime_infoObject



34
35
36
# File 'lib/javonet-ruby-sdk/core/receiver/receiver.rb', line 34

def self.get_runtime_info
  RuntimeLogger.get_runtime_info(true)
end

.heart_beat(message_array) ⇒ Object



29
30
31
32
# File 'lib/javonet-ruby-sdk/core/receiver/receiver.rb', line 29

def self.heart_beat(message_array)
  response_array = [49, 48]
  [response_array.length, response_array]
end

.send_command(message_array) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/javonet-ruby-sdk/core/receiver/receiver.rb', line 9

def self.send_command(message_array)
  begin
    response_array = CommandSerializer.serialize(Interpreter.process(message_array))
  rescue Exception => e
    message = "Error occurred in Javonet Ruby Core: #{e.message}"
    puts message
    exception_command = Command.new(RuntimeNameJavonet::RUBY, CommandType::EXCEPTION, [])
    exception_command = exception_command.add_arg_to_payload(ExceptionType::EXCEPTION)
    exception_command = exception_command.add_arg_to_payload(Command.new(RuntimeNameJavonet::RUBY, CommandType::EXCEPTION, ["Ruby Core Error", "Ruby Core Error"]).to_string)
    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("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 = CommandSerializer.serialize(exception_command)
  end
    [response_array.length, response_array]
end