Sha256: 16471cffd10c6502b1c922e3968752efdf9453c54e7b035083d3f4eff10a7748

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

require 'rbconfig'

# Utility to load native binaries on Java CLASSPATH
# HACK until jruby returns a more specific 'host_os' than 'linux'
class NativeFolder
  attr_reader :os, :bit

  LINUX_FORMAT = 'linux%s'
  ARM32 = '-armv6hf'
  # ARM64 = '-aarch64'.freeze

  def initialize
    @os = RbConfig::CONFIG['host_os'].downcase
    @bit = java.lang.System.get_property('os.arch')
  end

  def name
    if /linux/.match?(os)
      return format(LINUX_FORMAT, '64') if /amd64/.match?(bit)
      return format(LINUX_FORMAT, ARM32) if /arm/.match?(bit)
    end
    raise 'Unsupported Architecture'
  end

  def extension
    '*.so'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picrate-2.0.0.pre-java lib/picrate/native_folder.rb