Top Level Namespace

Defined Under Namespace

Modules: Zstd

Instance Method Summary collapse

Instance Method Details

#ext_export_filenameObject

Determine which export file to use based on Ruby version



23
24
25
26
27
# File 'ext/zstdruby/extconf.rb', line 23

def ext_export_filename
  name = 'ext-export'
  name += '-with-ruby-abi-version' if have_ruby_abi_version?
  name
end

#have_ruby_abi_version?Boolean

Check if ruby_abi_version symbol is required Based on grpc’s approach: github.com/grpc/grpc/blob/master/src/ruby/ext/grpc/extconf.rb

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'ext/zstdruby/extconf.rb', line 7

def have_ruby_abi_version?
  # Only development/preview versions need the symbol
  return false if RUBY_PATCHLEVEL >= 0
  
  # Ruby 3.2+ development versions require ruby_abi_version
  major, minor = RUBY_VERSION.split('.').map(&:to_i)
  if major > 3 || (major == 3 && minor >= 2)
    puts "Ruby version #{RUBY_VERSION} >= 3.2. Using ruby_abi_version symbol."
    return true
  else
    puts "Ruby version #{RUBY_VERSION} < 3.2. Not using ruby_abi_version symbol."
    return false
  end
end