End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Integer#size
int.size → int
numeric.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/numeric.rb, line 199
def size
Primitive.attr! 'inline'
Primitive.cexpr! 'rb_int_size(self)'
end
Document-method: Integer#size
Returns the number of bytes in the machine representation of int (machine dependent).
Example
1.size #=> 8 -1.size #=> 8 2147483647.size #=> 8 (256**10 - 1).size #=> 10 (256**20 - 1).size #=> 20 (256**40 - 1).size #=> 40