Class: RuntimeFactory

Inherits:
AbstractRuntimeFactory show all
Defined in:
lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb

Overview

The RuntimeFactory class implements the AbstractRuntimeFactory interface and provides methods for creating runtime contexts. Each method corresponds to a specific runtime (CLR, JVM, .NET Core, Perl, Ruby, Node.js, Python) and returns a RuntimeContext instance for that runtime.

@see Refer to this article on Javonet Guides

Instance Method Summary collapse

Constructor Details

#initialize(connection_type, tcp_address = nil) ⇒ RuntimeFactory

Returns a new instance of RuntimeFactory.



10
11
12
13
14
15
16
17
18
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 10

def initialize(connection_type, tcp_address = nil)
  @connection_type = connection_type
  if @connection_type == ConnectionType::TCP
    if tcp_address.nil?
      raise("Error tcp ip adress is not given!")
    end
  end
  @tcp_address = tcp_address
end

Instance Method Details

#clr ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with CLR runtime.

Returns:

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


23
24
25
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 23

def clr
  RuntimeContext.get_instance(RuntimeName::CLR, @connection_type, @tcp_address)
end

#jvm ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with JVM runtime.

Returns:

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


30
31
32
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 30

def jvm
  RuntimeContext.get_instance(RuntimeName::JVM, @connection_type, @tcp_address)
end

#netcore ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with .NET runtime.

Returns:

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


37
38
39
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 37

def netcore
  RuntimeContext.get_instance(RuntimeName::NETCORE, @connection_type, @tcp_address)
end

#nodejs ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with Node.js runtime.

Returns:

  • (RuntimeContext) —

    a RuntimeContext instance for the Node.js runtime

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


58
59
60
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 58

def nodejs
  RuntimeContext.get_instance(RuntimeName::NODEJS, @connection_type, @tcp_address)
end

#perl ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with Perl runtime.

Returns:

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


44
45
46
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 44

def perl
  RuntimeContext.get_instance(RuntimeName::PERL, @connection_type, @tcp_address)
end

#python ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with Python runtime.

Returns:

  • (RuntimeContext) —

    a RuntimeContext instance for the Python runtime

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


65
66
67
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 65

def python
  RuntimeContext.get_instance(RuntimeName::PYTHON, @connection_type, @tcp_address)
end

#ruby ⇒ RuntimeContext

Creates a RuntimeContext instance to interact with Ruby runtime.

Returns:

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/runtime-context article on Javonet Guides}


51
52
53
# File 'lib/javonet-ruby-sdk/sdk/internal/runtime_factory.rb', line 51

def ruby
  RuntimeContext.get_instance(RuntimeName::RUBY, @connection_type, @tcp_address)
end