Class: ArraySetItemHandler
- Inherits:
-
AbstractCommandHandler
- Object
- AbstractCommandHandler
- ArraySetItemHandler
- Defined in:
- lib/javonet-ruby-sdk/core/handler/command_handler/array_set_item_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/command_handler/array_set_item_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/command_handler/array_set_item_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/command_handler/array_set_item_handler.rb
Instance Method Summary collapse
-
#initialize ⇒ ArraySetItemHandler
constructor
A new instance of ArraySetItemHandler.
- #process(command) ⇒ Object
Methods inherited from AbstractCommandHandler
Constructor Details
#initialize ⇒ ArraySetItemHandler
Returns a new instance of ArraySetItemHandler.
4 5 6 |
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/array_set_item_handler.rb', line 4 def initialize @required_parameters_count = 3 end |
Instance Method Details
#process(command) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/array_set_item_handler.rb', line 7 def process(command) begin if command.payload.length < @required_parameters_count raise ArgumentError.new "Array set item parameters mismatch" end array = command.payload[0] value = command.payload[1] index = command.payload[2,] array[index] = value return 0 rescue Exception => e return e end end |