Module: HyperCast::NativePlatform

Defined in:
lib/hypercast/native_platform.rb

Overview

Maps the running RUBY_PLATFORM to the RID-style directory (matching the other bindings' runtimes/rid/native/ / native/rid/ convention) and native library filename to load.

Defined Under Namespace

Classes: UnsupportedPlatformError

Class Method Summary collapse

Class Method Details

.rid_and_library_nameObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hypercast/native_platform.rb', line 7

def self.rid_and_library_name
  is_arm = RUBY_PLATFORM.match?(/arm64|aarch64/)

  case RUBY_PLATFORM
  when /mingw|mswin|windows/
    is_arm ? ["win-arm64", "hypercast.dll"] : ["win-x64", "hypercast.dll"]
  when /darwin/
    is_arm ? ["osx-arm64", "libhypercast.dylib"] : ["osx-x64", "libhypercast.dylib"]
  when /linux/
    is_arm ? ["linux-arm64", "libhypercast.so"] : ["linux-x64", "libhypercast.so"]
  else
    raise UnsupportedPlatformError, "hypercast: unsupported platform RUBY_PLATFORM=#{RUBY_PLATFORM}"
  end
end