Skip to content

Commit

Permalink
Fix #269 - Use Ruby major and minor versions to load extension, but n…
Browse files Browse the repository at this point in the history
…ot the patch level.
  • Loading branch information
cfis committed Apr 20, 2020
1 parent f4ea25c commit 1b297a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -38,7 +38,7 @@ Rake::ExtensionTask.new do |ext|
ext.gem_spec = default_spec
ext.name = SO_NAME
ext.ext_dir = "ext/#{SO_NAME}"
ext.lib_dir = "lib/#{RUBY_VERSION}"
ext.lib_dir = "lib/#{Gem::Version.new(RUBY_VERSION).segments[0..1].join('.')}"
ext.cross_compile = true
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
end
Expand Down
5 changes: 3 additions & 2 deletions lib/ruby-prof.rb
@@ -1,9 +1,10 @@
# encoding: utf-8
require 'rubygems/version'

# Load the C-based binding.
begin
RUBY_VERSION =~ /(\d+\.\d+\.\d+)/
require "#{$1}/ruby_prof.so"
version = Gem::Version.new(RUBY_VERSION)
require "#{version.segments[0..1].join('.')}/ruby_prof.so"
rescue LoadError
require "ruby_prof.so"
end
Expand Down

0 comments on commit 1b297a3

Please sign in to comment.