Class: NativeFolder
- Inherits:
-
Object
- Object
- NativeFolder
- Defined in:
- lib/jruby_art/native_folder.rb
Overview
Utility to load native binaries on Java CLASSPATH
Constant Summary collapse
- WIN_FORMAT =
'windows%d'.freeze
- LINUX_FORMAT =
'linux%d'.freeze
- WIN_PATTERNS =
[ /bccwin/i, /cygwin/i, /djgpp/i, /ming/i, /mswin/i, /wince/i ].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.
18 19 20 21 |
# File 'lib/jruby_art/native_folder.rb', line 18 def initialize @os = RbConfig::CONFIG['host_os'].downcase @bit = java.lang.System.get_property('os.arch') =~ /64/ ? 64 : 32 end |
Instance Attribute Details
#bit ⇒ Object (readonly)
Returns the value of attribute bit.
5 6 7 |
# File 'lib/jruby_art/native_folder.rb', line 5 def bit @bit end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
5 6 7 |
# File 'lib/jruby_art/native_folder.rb', line 5 def os @os end |
Instance Method Details
#extension ⇒ Object
29 30 31 32 33 |
# File 'lib/jruby_art/native_folder.rb', line 29 def extension return '*.so' if os =~ /linux/ return '*.dll' if WIN_PATTERNS.any? { |pat| pat =~ os } '*.dylib' # MacOS end |
#name ⇒ Object
23 24 25 26 27 |
# File 'lib/jruby_art/native_folder.rb', line 23 def name return 'macosx' if os =~ /darwin/ || os =~ /mac/ return format(WIN_FORMAT, bit) if WIN_PATTERNS.any? { |pat| pat =~ os } return format(LINUX_FORMAT, bit) if os =~ /linux/ end |