Module: Libcall::Platform

Defined in:
lib/libcall/platform.rb

Overview

Platform detection utilities

Class Method Summary collapse

Class Method Details

.architectureObject

Get architecture string



33
34
35
36
37
38
39
40
41
# File 'lib/libcall/platform.rb', line 33

def self.architecture
  if RUBY_PLATFORM =~ /x86_64/
    'x86_64'
  elsif RUBY_PLATFORM =~ /aarch64|arm64/
    'aarch64'
  else
    'unknown'
  end
end

.darwin?Boolean

Check if running on macOS

Returns:

  • (Boolean)


12
13
14
# File 'lib/libcall/platform.rb', line 12

def self.darwin?
  RUBY_PLATFORM =~ /darwin/
end

.library_extensionsObject

Get platform-specific library extensions



22
23
24
25
26
27
28
29
30
# File 'lib/libcall/platform.rb', line 22

def self.library_extensions
  if windows?
    ['', '.dll', '.so', '.a']
  elsif darwin?
    ['', '.dylib', '.so', '.a']
  else
    ['', '.so', '.a']
  end
end

.unix?Boolean

Check if running on Unix-like system (Linux, BSD, etc.)

Returns:

  • (Boolean)


17
18
19
# File 'lib/libcall/platform.rb', line 17

def self.unix?
  !windows?
end

.windows?Boolean

Check if running on Windows

Returns:

  • (Boolean)


7
8
9
# File 'lib/libcall/platform.rb', line 7

def self.windows?
  RUBY_PLATFORM =~ /mswin|mingw|cygwin/
end