Class: Factorix::Runtime

Inherits:
Object
  • Object
show all
Defined in:
lib/factorix/runtime.rb,
lib/factorix/runtime/wsl.rb,
lib/factorix/runtime/base.rb,
lib/factorix/runtime/linux.rb,
lib/factorix/runtime/mac_os.rb,
lib/factorix/runtime/windows.rb,
lib/factorix/runtime/user_configurable.rb

Overview

Factorio runtime environment abstraction

This class provides a factory method to detect the current platform and return the appropriate runtime environment instance.

Defined Under Namespace

Modules: UserConfigurable Classes: Base, Linux, MacOS, WSL, Windows

Class Method Summary collapse

Class Method Details

.detectRuntime::Base

Detect the current platform and return the appropriate runtime

Returns:

  • (Runtime::Base)

    the runtime environment for the current platform

Raises:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/factorix/runtime.rb', line 13

def self.detect
  case RUBY_PLATFORM
  when /darwin/
    MacOS.new
  when /mingw|mswin/
    Windows.new
  when /linux/
    wsl? ? WSL.new : Linux.new
  else
    raise UnsupportedPlatformError, "Platform is not supported: #{RUBY_PLATFORM}"
  end
end