Sha256: 06fdb42bb0de2a345bd29e5535f6ee724160b77ea32f56a8a0d0e7aa2cf3277e

Contents?: true

Size: 737 Bytes

Versions: 28

Compression:

Stored size: 737 Bytes

Contents

require_relative 'abstract_command_handler'
require_relative '../type_cache/type_cache'

class EnableTypeHandler < AbstractCommandHandler
  def initialize
    @required_parameters_count = 1
  end

  def process(command)
    begin
      if command.payload.length < @required_parameters_count
        raise "#{self.class.name} parameters mismatch!"
      end

      type_cache = TypeCache.instance

      command.payload.each do |payload|
        if payload.is_a? String
          type_cache.cache_type(payload)
        elsif payload.is_a? Array
          payload.each do |type_to_enable|
            type_cache.cache_type(type_to_enable)
          end
        end

      end
      0
    end
  rescue Exception => e
    return e
  end
end

Version data entries

28 entries across 14 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/enable_type_handler.rb
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/enable_type_handler.rb