Class: Hypertube::Core::Handler::ResolveInstanceHandler

Inherits:
AbstractHandler show all
Defined in:
lib/hypertube-ruby-sdk/core/handler/resolve_instance_handler.rb

Instance Method Summary collapse

Methods inherited from AbstractHandler

#handle_command, #validate

Constructor Details

#initializeResolveInstanceHandler

Returns a new instance of ResolveInstanceHandler.



12
13
14
# File 'lib/hypertube-ruby-sdk/core/handler/resolve_instance_handler.rb', line 12

def initialize
  @required_parameters_count = 1
end

Instance Method Details

#process(command) ⇒ Object



16
17
18
# File 'lib/hypertube-ruby-sdk/core/handler/resolve_instance_handler.rb', line 16

def process(command)
  resolve_reference(command)
end

#resolve_reference(command) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/hypertube-ruby-sdk/core/handler/resolve_instance_handler.rb', line 20

def resolve_reference(command)
  validate(command, @required_parameters_count, self.class.name)

  if command.runtime_name == Hypertube::Utils::RuntimeNameHt::RUBY
    return Hypertube::Core::ReferenceCache::ReferencesCache.instance.resolve_reference(command.payload[0])
  end

  Hypertube::Utils::Command.new(command.runtime_name, Hypertube::Utils::CommandType::REFERENCE, command.payload[0])
end