Sha256: 75122a74bbb242365328479153105a8990501ac391aa7184f30afdfe5ccee7b9
Contents?: true
Size: 540 Bytes
Versions: 48
Compression:
Stored size: 540 Bytes
Contents
require_relative 'abstract_command_handler' class ArrayGetRankHandler < AbstractCommandHandler def initialize @required_parameters_count = 1 end def process(command) begin if command.payload.length < @required_parameters_count raise ArgumentError.new "Array get rank parameters mismatch" end array = command.payload[0] rank = 0 while array.is_a? Array rank = rank + 1 array = array[0] end return rank rescue Exception => e return e end end end
Version data entries
48 entries across 24 versions & 1 rubygems