Hello,
The following snippet:
#!/usr/bin/ruby -w
require 'date'
class MyDate < Date
def self.today
super
end
end
puts MyDate.today.class
## end
prints out 'MyDate' with ruby 1.8.4 and 1.8.5, but 'Date' with 1.8.6
Is this a bug in 1.8.6, or the correction of a long lived bug in
versions before ?
Cheers,
Han Holl
It looks like perhaps the date library has changed in 1.8.6
http://svn.ruby-lang.org/repos/ruby/tags/v1_8_6/NEWS
" * date
* Updated based on date2 4.0.3. "
I've not investigated further.
···
On 7/3/07, Han Holl <han.holl@gmail.com> wrote:
Hello,
The following snippet:
#!/usr/bin/ruby -w
require 'date'
class MyDate < Date
def self.today
super
end
end
puts MyDate.today.class
## end
prints out 'MyDate' with ruby 1.8.4 and 1.8.5, but 'Date' with 1.8.6
Is this a bug in 1.8.6, or the correction of a long lived bug in
versions before ?
Indeed.
My question was whether this should be considered a bug: #today is
kind of a specialized version of #new, so I would expect the
implementation to be #new like, and return a MyDate.
Cheers,
Han Holl
···
On 7/3/07, Gregory Brown <gregory.t.brown@gmail.com> wrote:
It looks like perhaps the date library has changed in 1.8.6
http://svn.ruby-lang.org/repos/ruby/tags/v1_8_6/NEWS
" * date
* Updated based on date2 4.0.3. "
I've not investigated further.
That sounds to me like someone used Date.new instead of self.new in
class method somewhere.
And yeah, I'd look at it as a bug too. As a workaround, you can
probably do a manual conversion...
···
On 7/4/07, Han Holl <han.holl@gmail.com> wrote:
Indeed.
My question was whether this should be considered a bug: #today is
kind of a specialized version of #new, so I would expect the
implementation to be #new like, and return a MyDate.