Forum: Ruby Re. NameError: uninitialized constant Date::ABBR_MONTHS

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2adbbe58bd5008a7ba6180de2414cd91?d=identicon&s=25 Chris Duncan (Guest)
on 2007-04-11 08:22
(Received via mailing list)
Jigar Gosar wrote:

> Please help
Hi Gosar,

In your irb example you have DATE::ABBR_MONTHS instead of
Date::ABBR_MONTHS. In this case Ruby interprets DATE as a constant
instead of a class, therefore you get an error. Here's my output:

irb(main):001:0> require 'date'
=> true
irb(main):002:0> Date::ABBR_MONTHS
=> {"oct"=>10, "jul"=>7, "jan"=>1, "dec"=>12, "jun"=>6, "apr"=>4,
"feb"=>2, "may"=>5, "sep"=>9, "aug"=>8, "mar"=>3, "nov"=>11}
irb(main):003:0> DATE::ABBR_MONTHS
NameError: uninitialized constant DATE
         from (irb):3



This topic is locked and can not be replied to.