Module: Itsi::Server::NativeExtension
- Defined in:
- lib/itsi/server/native_extension.rb
Class Method Summary collapse
Class Method Details
.require! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/itsi/server/native_extension.rb', line 10 def require! ruby_abi = RUBY_VERSION[/\A\d+\.\d+/] if ruby_abi && versioned_binary_present?(ruby_abi) begin require_relative "#{ruby_abi}/itsi_server" return rescue LoadError # Fall back to the source-built extension when a packaged binary # exists but cannot be loaded on this machine. end end require_relative "itsi_server" end |
.versioned_binary_present?(ruby_abi) ⇒ Boolean
26 27 28 29 |
# File 'lib/itsi/server/native_extension.rb', line 26 def versioned_binary_present?(ruby_abi) binary_path = File.join(__dir__, ruby_abi, "itsi_server.#{RbConfig::CONFIG.fetch("DLEXT")}") File.exist?(binary_path) end |