Get value from .NET Framework DLL in Ruby

The GetValue method is used to retrieve the result of an operation performed by the Javonet API.

# use activate only once in your app

# create called runtime context
called_runtime = Javonet.in_memory.clr

# construct an invocation context - this invocationContext in non-materialized 
invocation_context = called_runtime.get_type('System.Math').invoke_static_method('Abs', -50)

# execute invocation context - this will materialize the invocationContext
response = invocation_context.execute

# get value from response
result = response.get_value

# write result to console
puts result

Commands are becoming nested through each invocation of methods on Invocation Context. Each invocation triggers the creation of new Invocation Context instance wrapping the current command with new parent command valid for invoked method.

Developer can decided on any moment of the materialization for the context taking full control of the chunks of the expression being transferred and processed on target runtime.