Class: AbstractCommandHandler

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

Instance Method Summary collapse

Instance Method Details

#handle_command(command) ⇒ Object



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

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

#iterate(command) ⇒ Object



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

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



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

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