Hi,
In message "[ruby-talk:15840] Re: subclassing Date"
on 01/05/28, Michael Husmann <Michael.Husmann / teleatlas.com> writes:
|Could you look at it again? Thank you,
You're defining an instance method new3. I think you have to define a
class method, for example:
class My_date < Date
def My_date.new(st)
l = st.split(".")
p l
y, m, d = l.collect{|s| s.to_i}
printf("year: %d, month: %d, day: %d\n", y, m, d)
super(y,m,d)
end
end
st = "2001.5.28"
d = My_date.new(st)
It works fine for me.
matz.