Class: EnableNamespaceHandler
- Inherits:
-
AbstractCommandHandler
- Object
- AbstractCommandHandler
- EnableNamespaceHandler
- Defined in:
- lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/enable_namespace_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/enable_namespace_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/enable_namespace_handler.rb
Instance Method Summary collapse
-
#initialize ⇒ EnableNamespaceHandler
constructor
A new instance of EnableNamespaceHandler.
- #process(command) ⇒ Object
Methods inherited from AbstractCommandHandler
Constructor Details
#initialize ⇒ EnableNamespaceHandler
Returns a new instance of EnableNamespaceHandler.
5 6 7 |
# File 'lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb', line 5 def initialize @required_parameters_count = 1 end |
Instance Method Details
#process(command) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/javonet-ruby-sdk/core/handler/enable_namespace_handler.rb', line 9 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 |