iTranslated by AI
Ruby 3.2 - Removed Classes and Constants
This is the article for day 4 of the Ruby 3.2 Advent Calendar.
Removed Classes and Constants
Fixnum / Bignum
Feature #12005: Unify Fixnum and Bignum into Integer - Ruby master - Ruby Issue Tracking System
Since Ruby 2.4, Fixnum and Bignum have been deprecated and became aliases for Integer.
Warning[:deprecated] = true
Fixnum #=> Integer
#=> warning: constant ::Fixnum is deprecated
Bignum #=> Integer
#=> warning: constant ::Bignum is deprecated
They have finally been removed in Ruby 3.2.
Fixnum
#=> uninitialized constant Fixnum (NameError)
Bignum
#=> uninitialized constant Bignum (NameError)
It took a long time until they were gone...
Random::DEFAULT
Up until Ruby 2.7, Random::DEFAULT returned a Random object representing the default random number generator (I'm not entirely sure about the details), but since it wasn't thread-safe, Random::DEFAULT was deprecated in Ruby 3.0 and started returning the Random class itself.
Warning[:deprecated] = true
Random::DEFAULT #=> Random
#=> warning: constant Random::DEFAULT is deprecated
It has been removed in Ruby 3.2.
Random::DEFAULT
#=> uninitialized constant Random::DEFAULT (NameError)
Struct::Group / Struct::Passwd
When you called require 'etc', for some reason Struct::Group and Struct::Passwd were created, although they were actually Etc::Group and Etc::Passwd.
They have been deprecated since Ruby 3.0.
Warning[:deprecated] = true
require 'etc'
Struct::Group #=> Etc::Group
#=> warning: constant Struct::Group is deprecated
Struct::Passwd #=> Etc::Passwd
#=> warning: constant Struct::Passwd is deprecated
They have been removed in Ruby 3.2.
require 'etc'
Struct::Group #=> Etc::Group
#=> uninitialized constant Struct::Group (NameError)
Struct::Passwd #=> Etc::Passwd
#=> uninitialized constant Struct::Passwd (NameError)
By the way, I wonder why they existed under Struct in the first place.
Discussion