Top Level Namespace
Defined Under Namespace
Modules: RDKitChem
Instance Method Summary collapse
-
#find_rdkit_native_extension ⇒ Object
Try to load the native extension from multiple possible locations: 1.
Instance Method Details
#find_rdkit_native_extension ⇒ Object
Try to load the native extension from multiple possible locations:
-
Pre-compiled gem: lib/rdkit_chem/<ruby_version>/RDKitChem.so
-
Source-compiled gem: rdkit_chem/lib/RDKitChem.so (legacy location)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rdkit_chem.rb', line 9 def find_rdkit_native_extension ruby_version = "#{RUBY_VERSION.split('.')[0..1].join('.')}.0" # Location 1: Pre-compiled gem (platform-specific) precompiled_path = File.("rdkit_chem/#{ruby_version}", __dir__) if File.directory?(precompiled_path) return precompiled_path end # Location 2: Source-compiled gem (legacy rdkit_chem/lib/) source_compiled_path = File.('../rdkit_chem/lib', __dir__) if File.exist?(File.join(source_compiled_path, 'RDKitChem.so')) || File.exist?(File.join(source_compiled_path, 'RDKitChem.bundle')) return source_compiled_path end raise LoadError, "Cannot find RDKitChem native extension. " \ "Searched in:\n - #{precompiled_path}\n - #{source_compiled_path}" end |