Bug #15500
Updated by mrkn (Kenta Murata) almost 6 years ago
On Ruby 2.5, `require 'bigdecimal'` does not load `bigdecimal.so` in gem-installed version of bigdecimal without specifying the version by `gem` method. You can examine this phenomenon by the following code. ```ruby require 'bigdecimal' p $LOADED_FEATURES.grep(/bigdecimal/).first ``` After installing bigdecimal-1.4.2 by `gem install bigdecimal` command, this code (saved as `t.rb`) show the following results: On Ruby 2.4.5 ``` $ ruby-2.4.5 -v t.rb ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-darwin18] "/Users/mrkn/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bigdecimal-1.4.2/lib/bigdecimal.bundle" ``` On Ruby 2.5.3: ``` $ ruby-2.5.3 -v t.rb ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18] "/Users/mrkn/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/bigdecimal.bundle" ``` On Ruby 2.6.0: ``` $ ruby-2.6.0 -v t.rb ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18] "/Users/mrkn/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bigdecimal-1.4.2/lib/bigdecimal.bundle" ``` On Ruby 2.5.3, with `gem 'bigdecimal', '1.4.2'`, the correct file can be loaded. ``` $ ( { echo "gem 'bigdecimal', '1.4.2'"; cat t.rb ) } | ruby-2.5.3 -v - ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18] "/Users/mrkn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bigdecimal-1.4.2/lib/bigdecimal.bundle" ```