Sha256: 79ab339b0ed144cafca19b3d986b15fb1ecaf3f9c4e5c77eedcb3d2af73a520e

Contents?: true

Size: 858 Bytes

Versions: 28

Compression:

Stored size: 858 Bytes

Contents

require_relative 'abstract_command_handler'
require_relative '../namespace_cache/namespace_cache'

class EnableNamespaceHandler < AbstractCommandHandler
  def initialize
    @required_parameters_count = 1
  end

  def process(command)
    begin
      if command.payload.length < @required_parameters_count
        raise ArgumentError.new "#{self.class.name} parameters mismatch"
      end
      namespace_cache = NamespaceCache.instance

      command.payload.each do |payload|
        if payload.is_a? String
          namespace_cache.cache_namespace(payload)
        elsif payload.is_a? Array
          payload.each do |type_to_enable|
            namespace_cache.cache_namespace(type_to_enable)
            cache_namespace
          end
        end
      end
      0
    rescue Exception => e
      return e
    end
  end
end

Version data entries

28 entries across 14 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb