Class: ResolveInstanceHandler

Inherits:
AbstractCommandHandler show all
Defined in:
lib/javonet-ruby-sdk/core/handler/resolve_instance_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/resolve_instance_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/resolve_instance_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/resolve_instance_handler.rb

Instance Method Summary collapse

Methods inherited from AbstractCommandHandler

#handle_command, #iterate

Constructor Details

#initializeResolveInstanceHandler

Returns a new instance of ResolveInstanceHandler.



5
6
7
# File 'lib/javonet-ruby-sdk/core/handler/resolve_instance_handler.rb', line 5

def initialize
  @required_parameters_count = 1
end

Instance Method Details

#process(command) ⇒ Object



9
10
11
# File 'lib/javonet-ruby-sdk/core/handler/resolve_instance_handler.rb', line 9

def process(command)
  return resolve_reference(command)
end

#resolve_reference(command) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/javonet-ruby-sdk/core/handler/resolve_instance_handler.rb', line 13

def resolve_reference(command)
  if command.payload.length != @required_parameters_count
    raise ArgumentError.new "Resolve Instance parameters mismatch"
  end
  begin
    references_cache = ReferencesCache.instance
    return references_cache.resolve_reference(command.payload[0])
  rescue Exception => ex
    return ex
  end
end