Module: Libcall::Platform
- Defined in:
- lib/libcall/platform.rb
Overview
Platform detection utilities
Class Method Summary collapse
-
.architecture ⇒ Object
Get architecture string.
-
.darwin? ⇒ Boolean
Check if running on macOS.
-
.library_extensions ⇒ Object
Get platform-specific library extensions.
-
.unix? ⇒ Boolean
Check if running on Unix-like system (Linux, BSD, etc.).
-
.windows? ⇒ Boolean
Check if running on Windows.
Class Method Details
.architecture ⇒ Object
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
12 13 14 |
# File 'lib/libcall/platform.rb', line 12 def self.darwin? RUBY_PLATFORM =~ /darwin/ end |
.library_extensions ⇒ Object
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.)
17 18 19 |
# File 'lib/libcall/platform.rb', line 17 def self.unix? !windows? end |
.windows? ⇒ Boolean
Check if running on Windows
7 8 9 |
# File 'lib/libcall/platform.rb', line 7 def self.windows? RUBY_PLATFORM =~ /mswin|mingw|cygwin/ end |