NoMethodError: undefined method 'new' for Fixnum:Class : Fixnum extension « Number « Ruby






NoMethodError: undefined method 'new' for Fixnum:Class


puts 100.object_id                                # => 201
puts (10 * 10).object_id                          # => 201
Fixnum.new(100)

 








Related examples in the same category

1.Calculating a factorial in Ruby
2.Simulating a Subclass of Fixnum
3.Add double_upto method to Fixnum
4.redefine basic arithmetic