Class: DTK::Client::ContextRouter

Inherits:
Object
  • Object
show all
Extended by:
Auxiliary
Defined in:
lib/context_router.rb

Overview

This class is used to reroute commands/tasks (Method invocations) from one context (Class) to another

Class Method Summary collapse

Methods included from Auxiliary

cap_form, snake_form

Class Method Details

.routeTask(target_context, target_method, target_context_params, conn) ⇒ Object

This method invokes target context task



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/context_router.rb', line 29

def self.routeTask(target_context, target_method, target_context_params, conn)
  target_context = target_context.to_s
  target_method  = target_method.to_s

  # Initing required params and invoking target_context.target_method
  load_command(target_context)
  target_context_class = DTK::Client.const_get "#{cap_form(target_context)}"

  ret = target_context_class.execute_from_cli(conn, target_method, target_context_params, [], false)
  ret.kind_of?(Response::NoOp) ? Response::Ok.new() : ret
end