Sha256: 9b356fd2aa6a6aa9ac3f54b6e15d565e8c5f38d9c5d4208022fba047f5ae7917
Contents?: true
Size: 859 Bytes
Versions: 9
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true require 'rbconfig' # Utility to load native binaries on Java CLASSPATH class NativeFolder attr_reader :os, :bit WIN_FORMAT = 'windows%d' LINUX_FORMAT = 'linux%d' WIN_PATTERNS = [ /bccwin/i, /cygwin/i, /djgpp/i, /ming/i, /mswin/i, /wince/i ].freeze def initialize @os = RbConfig::CONFIG['host_os'].downcase @bit = /64/.match?(java.lang.System.get_property('os.arch')) ? 64 : 32 end def name return 'macosx' if /darwin|mac/.match?(os) return format(LINUX_FORMAT, bit) if /linux/.match?(os) return format(WIN_FORMAT, bit) if WIN_PATTERNS.any? { |pat| pat.match?(os) } raise 'Unsupported Architecture' end def extension return '*.so' if /linux/.match?(os) return '*.dll' if WIN_PATTERNS.any? { |pat| pat.match?(os) } '*.dylib' # MacOS end end
Version data entries
9 entries across 9 versions & 1 rubygems