Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re. NameError: uninitialized constant Date::ABBR_MONTHS
Chris Duncan
4/11/2007 6:22:00 AM
Jigar Gosar wrote:
>
> DATE::ABBR_MONTHS exists in this doc here.
>
http://www.ruby-doc.org/stdlib/libdoc/date/rdoc/...
> Still I get the error.
>
>
>> ruby -v
>>
> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
>
>
> irb(main):001:0> require "date"
> => true
> irb(main):002:0> Date::MONTHNAMES
> => [nil, "January", "February", "March", "April", "May", "June",
> "July",
> "August", "September", "October", "November", "December"]
> irb(main):003:0> DATE::ABBR_MONTHS
> NameError: uninitialized constant DATE
> from (irb):3
> irb(main):004:0>
>
>
>
> DATE::ABBR_MONTHS exists in this doc here.
>
http://www.ruby-doc.org/stdlib/libdoc/date/rdoc/...
>
> And I was using this functionality till ruby 1.8.2 it suddenly stoped
> with the upgrade. can these guys just remove stuff without
> warning!!! or
> am I looking at wrong place?
>
> 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
HTH.
Regards,
Chris
http://rotsog.wor...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re. NameError: uninitialized constant Date::ABBR_MONTHS
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password