Sha256: c55608d381f29ea4a52994e09629e0231be34131ed096220b6ac2db8bcb2f124

Contents?: true

Size: 1.23 KB

Versions: 24

Compression:

Stored size: 1.23 KB

Contents

require_relative '../protocol/command_serializer'
require_relative '../protocol/command_deserializer'
require_relative '../handler/handler'

class Interpreter
  def execute(command, connection_type, tcp_connection_data)

    command_serializer = CommandSerializer.new
    message_byte_array = command_serializer.serialize(command, connection_type, tcp_connection_data)
    if command.runtime_name == RuntimeName::RUBY && connection_type == ConnectionType::IN_MEMORY
      require_relative '../receiver/receiver'
      response_byte_array = Receiver.new.send_command(message_byte_array, message_byte_array.length)
    else
      require_relative '../transmitter/transmitter'
      response_byte_array = Transmitter.send_command(message_byte_array, message_byte_array.length)
    end

    command_deserializer = CommandDeserializer.new(response_byte_array,response_byte_array.length)
    command_deserializer.deserialize
  end

  def process(byte_array, byte_array_len)
    command_deserializer = CommandDeserializer.new(byte_array,byte_array_len)
    received_command = command_deserializer.deserialize
    handler = Handler.new
    command_serializer = CommandSerializer.new
    command_serializer.serialize(handler.handle_command(received_command))
  end
end

Version data entries

24 entries across 12 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/interpreter/interpreter.rb
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/interpreter/interpreter.rb
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/interpreter/interpreter.rb
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/interpreter/interpreter.rb