Class: NativeFolder
- Inherits:
-
Object
- Object
- NativeFolder
- Defined in:
- lib/picrate/native_folder.rb
Overview
Utility to load native binaries on Java CLASSPATH HACK until jruby returns a more specific ‘host_os’ than ‘linux’
Constant Summary collapse
- LINUX_FORMAT =
'linux%s'.freeze
- ARM32 =
'-armv6hf'.freeze
- ARM64 =
'-aarch64'.freeze
Instance Attribute Summary collapse
-
#bit ⇒ Object
readonly
Returns the value of attribute bit.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
Instance Method Summary collapse
- #extension ⇒ Object
-
#initialize ⇒ NativeFolder
constructor
A new instance of NativeFolder.
- #name ⇒ Object
Constructor Details
#initialize ⇒ NativeFolder
Returns a new instance of NativeFolder.
10 11 12 13 |
# File 'lib/picrate/native_folder.rb', line 10 def initialize @os = java.lang.System.get_property('os.name').downcase @bit = java.lang.System.get_property('os.arch') end |
Instance Attribute Details
#bit ⇒ Object (readonly)
Returns the value of attribute bit.
4 5 6 |
# File 'lib/picrate/native_folder.rb', line 4 def bit @bit end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
4 5 6 |
# File 'lib/picrate/native_folder.rb', line 4 def os @os end |
Instance Method Details
#extension ⇒ Object
24 25 26 |
# File 'lib/picrate/native_folder.rb', line 24 def extension '*.so' end |
#name ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/picrate/native_folder.rb', line 15 def name if /linux/.match?(os) return format(LINUX_FORMAT, '64') if /amd64/.match?(bit) return format(LINUX_FORMAT, ARM32) if /arm/.match?(bit) return format(LINUX_FORMAT, ARM64) if /aarch/.match?(bit) end raise RuntimeError, "Unsupported Architecture" end |