The return value of a method is the value of its last statement. This means that Myclass.new
following the definition below of the initialize
method with super
inside:
class Myclass < String
def initialize(arg)
super(arg.to_s)
"something"
end
end
should return "something"
. But it returns "test"
instead:
Myclass.new("test") # => "test"
Why?