class NativeFolder

Utility to load native binaries on Java CLASSPATH HACK until jruby returns a more specific 'host_os' than 'linux'

Constants

LINUX_FORMAT
WIN_FORMAT

ARM64 = '-aarch64'

WIN_PATTERNS

Attributes

bit[R]
os[R]

Public Class Methods

new() click to toggle source
# File lib/jruby_art/native_folder.rb, line 22
def initialize
  @os = RbConfig::CONFIG['host_os'].downcase
  @bit = /64/.match?(java.lang.System.get_property('os.arch')) ? 64 : 32
end

Public Instance Methods

extension() click to toggle source
# File lib/jruby_art/native_folder.rb, line 39
def extension
  return '*.so' if /linux/.match?(os)

  return '*.dll' if WIN_PATTERNS.any? { |pat| pat.match?(os) }

  '*.dylib' # MacOS
end
name() click to toggle source
# File lib/jruby_art/native_folder.rb, line 27
def name
  return macos if /darwin|mac/.match?(os)

  return format(LINUX_FORMAT, bit: bit) if /linux/.match?(os)

  unless WIN_PATTERNS.any? { |pat| pat.match?(os) }
    raise StandardError, 'Unsupported Architecture'
  end

  format(WIN_FORMAT, bit: bit)
end