Module: Rfmt::NativeExtensionLoader

Defined in:
lib/rfmt/native_extension_loader.rb

Overview

Handles loading of native extension across different Ruby versions Ruby 3.3+ places native extensions in version-specific subdirectories

Class Method Summary collapse

Class Method Details

.load_extensionBoolean

Load the native extension, trying multiple possible paths

Returns:

  • (Boolean)

    true if successfully loaded

Raises:

  • (LoadError)

    if the extension cannot be found



11
12
13
14
15
16
17
18
# File 'lib/rfmt/native_extension_loader.rb', line 11

def load_extension
  debug_log "Loading native extension for Ruby #{RUBY_VERSION}"

  possible_paths = build_possible_paths
  debug_log "Trying paths: #{possible_paths.inspect}"

  load_from_paths(possible_paths) || raise(LoadError, build_error_message(possible_paths))
end