languages/ruby/lib/oso/polar/host.rb
def make_instance(cls_name, args:, kwargs:, id:) # rubocop:disable Metrics/MethodLength
        constructor = get_constructor(cls_name)
        instance = if constructor == :new
                     if kwargs.empty?
                       get_class(cls_name).__send__(:new, *args)
                     else
                       get_class(cls_name).__send__(:new, *args, **kwargs)
                     end
                   elsif kwargs.empty?
                     constructor.call(*args)
                   else
                     constructor.call(*args, **kwargs)
                   end
        cache_instance(instance, id: id)
      rescue StandardError => e
        raise PolarRuntimeError, "Error constructing instance of #{cls_name}: #{e}"
      end
# Construct and cache a Ruby instance.
#
# @param cls_name [String]
# @param args [Array<Object>]
# @param kwargs [Hash<String, Object>]
# @param id [Integer]
# @raise [PolarRuntimeError] if instance construction fails.
Construct and cache a Ruby instance.
Construct and cache a Ruby instance .
def make_instance(cls_name, args:, kwargs:, id:) 
        constructor = get_constructor(cls_name)
        instance = if constructor == :new
                     if kwargs.empty?
                       get_class(cls_name).__send__(:new, *args)
                     else
                       get_class(cls_name).__send__(:new, *args, **kwargs)
                     end
                   elsif kwargs.empty?
                     constructor.call(*args)
                   else
                     constructor.call(*args, **kwargs)
                   end
        cache_instance(instance, id: id)
      rescue StandardError => e
        raise PolarRuntimeError, "Error constructing instance of #{cls_name}: #{e}"
      end
def make_instance ( cls_name , args : , kwargs : , id : ) constructor = get_constructor ( cls_name ) instance = if constructor == :new if kwargs . empty? get_class ( cls_name ) . __send__ ( :new , * args ) else get_class ( cls_name ) . __send__ ( :new , * args , ** kwargs ) end elsif kwargs . empty? constructor . call ( * args ) else constructor . call ( * args , ** kwargs ) end cache_instance ( instance , id : id ) rescue StandardError => e raise PolarRuntimeError , "Error constructing instance of #{cls_name}: #{e}" end
Construct and cache a Ruby instance.
Construct and cache a Ruby instance .
# rubocop:disable Metrics/MethodLength
[PolarRuntimeError] if instance construction fails.
[ PolarRuntimeError ] if instance construction fails .
cls_name
args
kwargs
id
None