I encountered a strange question about override initialize message of BigDecimal.
class Test1 < String
def initialize(a, b)
puts a
puts b
end
end
require 'bigdecimal'
class Test2 < BigDecimal
def initialize(a, b)
puts a
puts b
end
end
>> Test1.new('a', 'b')
a
b
>> Test2.new('a', 'b')
TypeError: wrong argument type String (expected Fixnum)
from (irb):17:in `new'
from (irb):17
Why I can override the initialize message of String, but not of BigDecimal?