Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#9809 - ruby undefined method Time.parse

Attached to Project: Arch Linux
Opened by kkl2401 (kkl2401) - Tuesday, 11 March 2008, 00:00 GMT
Last edited by Aaron Griffin (phrakture) - Monday, 31 March 2008, 16:43 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Andreas Radke (AndyRTR)
Architecture All
Severity Medium
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Description: Ruby from extra doesn't seem to know Time.parse() method.

Running the following:
echo "p Time.parse('2008-03-11')" | ruby
-:1: undefined method `parse' for Time:Class (NoMethodError)

If I try it on a non-Arch machine, I get the correct answer:
echo "p Time.parse('2008-03-11')" | ruby
Tue Mar 11 00:00:00 +0100 2008

I have the latest ruby from extra:
ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [x86_64-linux]
but the previous one (patchlevel 111) was also affected.
This task depends upon

Closed by  Aaron Griffin (phrakture)
Monday, 31 March 2008, 16:43 GMT
Reason for closing:  Not a bug
Additional comments about closing:  See last comment
Comment by Gerhard Brauer (GerBra) - Tuesday, 11 March 2008, 12:51 GMT
You can use this method when used with:
require 'time'

Don't know while not available without including time.rb.
But maybe they are extensions which need explicit including. From ruby.doc:
"Implements the extensions to the Time class that are described in the documentation for the time.rb library."

Also many other methods defined after Time.parse are not available without including (rfc2822,...)
Comment by Roman Kyrylych (Romashka) - Saturday, 15 March 2008, 11:00 GMT
so, can I close this as "Not a bug"?
Comment by kkl2401 (kkl2401) - Saturday, 15 March 2008, 11:18 GMT
Well, I personally still think it IS a bug. Even though "require 'time'" solves the problem for scripts I might be writing, adding this to all existing ruby programs that would expect that this isn't necessary is not very nice. I'm not sure exactly how archlinux's ruby package is created but it is so far the only ruby distribution having this problem I've encountered. Perhaps if the package maintainer told us his/her opinion on this matter?
Comment by Andreas Radke (AndyRTR) - Monday, 17 March 2008, 20:33 GMT

this is how we build it. i see nothing wrong there. if you tell me how to fix it, i might include it.
Comment by Michael Holub (mholub) - Thursday, 27 March 2008, 15:12 GMT
Sorry for my english :(

I think this is not a bug. The core ruby documentation is not the documentation of core ruby classes, but the output of rdoc program, running on ruby sources. Really core classes are the classes defined in files you can see in this topic So I think, that ruby on other machines of kkl2401 was builded with different build options.

kkl2401, can you provide output of "ruby -rrbconfig -e 'p Config::CONFIG'" from non-arch machine?
Comment by kkl2401 (kkl2401) - Sunday, 30 March 2008, 20:43 GMT
I've been gone for a couple of days but meanwhile I also did some more research which convinced that this indeed is not a bug after all, so someone please feel free to close it (I don't think I can do it myself).

I tried playing with it in a few environments (different Linux distributions, cygwin's ruby on Windows, jruby, ...) and I came to a conclusion that the difference was not ruby itself but a presence/absence of rubygems. It seems that rubygems somehow (perhaps also with the assistence of $RUBYOPTS) load the 'time' library and that was probably what confused me in the first place because I probably didn't have it installed on Arch but had it everywhere else and it didn't occur to me that this actually might be behind it.

So I'm sorry I brought it up, my bad (still, ruby could be better documented in some places... *sigh*).