Class: AbstractCommandHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/javonet-ruby-sdk/core/handler/command_handler/abstract_command_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/command_handler/abstract_command_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/command_handler/abstract_command_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/command_handler/abstract_command_handler.rb

Instance Method Summary collapse

Instance Method Details

#handle_command(command) ⇒ Object



7
8
9
10
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/abstract_command_handler.rb', line 7

def handle_command(command)
  iterate(command)
  return process(command)
end

#iterate(command) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/abstract_command_handler.rb', line 12

def iterate(command)
  (0..command.payload.length).step(1) do |i|
    if command.payload[i].is_a? Command
      command.payload[i] = $handler_dict[command.payload[i].command_type].handle_command(command.payload[i])
    end
  end
end

#process(command) ⇒ Object



20
21
22
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/abstract_command_handler.rb', line 20

def process(command)
  raise 'process is not implemented'
end