[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

When was the parse method added to the Time class?

Paul

3/13/2009 8:26:00 PM

Hi there, I've been running a particular script for a few years now
and only just noticed that it crashes on one particular system. (I
don't use that system very often and have run that script on it very
rarely.)

The offending code/line in question uses the Time.parse method.

I opened a CMD prompt and tried the following:
----
irb(main):001:0> d = '03/13/09 14:52'
=> "03/13/09 14:52"
irb(main):002:0> Time.parse( d )
NoMethodError: undefined method `parse' for Time:Class
from (irb):2
....
irb(main):010:0> Time.methods.include? 'parse'
=> false
----

This system has Ruby 184-20 installed. I know that version 186-25 and
up have the Time.parse method and the script works fine. However, I
want to know what version of Ruby first included that method so that I
can identify the minimum requirements to run the script.

Can anyone tell me how I might find out what version/release of Ruby
first included that method?

Please let me know. Thanks.

Paul.
6 Answers

Joel VanderWerf

3/13/2009 8:43:00 PM

0

Paul wrote:
> Hi there, I've been running a particular script for a few years now
> and only just noticed that it crashes on one particular system. (I
> don't use that system very often and have run that script on it very
> rarely.)
>
> The offending code/line in question uses the Time.parse method.
>
> I opened a CMD prompt and tried the following:
> ----
> irb(main):001:0> d = '03/13/09 14:52'
> => "03/13/09 14:52"
> irb(main):002:0> Time.parse( d )
> NoMethodError: undefined method `parse' for Time:Class
> from (irb):2
> ...
> irb(main):010:0> Time.methods.include? 'parse'
> => false
> ----
>
> This system has Ruby 184-20 installed. I know that version 186-25 and
> up have the Time.parse method and the script works fine. However, I
> want to know what version of Ruby first included that method so that I
> can identify the minimum requirements to run the script.
>
> Can anyone tell me how I might find out what version/release of Ruby
> first included that method?
>
> Please let me know. Thanks.
>
> Paul.

It's not a ruby version issue.

Confusingly, Time.parse is only available after explicitly requiring 'time':

irb(main):001:0> Time.parse "1:23"
NoMethodError: undefined method `parse' for Time:Class
from (irb):1
irb(main):002:0> require 'time'
=> true
irb(main):003:0> Time.parse "1:23"
=> Fri Mar 13 01:23:00 -0700 2009

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Paul

3/13/2009 9:45:00 PM

0

Joel wrote:

> It's not a ruby version issue.
>
> Confusingly, Time.parse is only available after explicitly requiring 'time':
>
> irb(main):001:0> Time.parse "1:23"
> NoMethodError: undefined method `parse' for Time:Class
>          from (irb):1
> irb(main):002:0> require 'time'
> => true
> irb(main):003:0> Time.parse "1:23"
> => Fri Mar 13 01:23:00 -0700 2009
>

Hmm, okay. I get that. So why does the "Time.methods.include?
'parse'" line work on all the other systems except for one? I'm not
specifically requiring that class on the other machines.

As a test, I uninstalled Ruby 184 and installed Ruby 186 and I get the
same effect on this computer -- i.e. the Time.parse method is still
not there by default. Weird. Could another Ruby gem be causing the
problem?

Paul.

Paul

3/13/2009 11:15:00 PM

0

>
> As a test, I uninstalled Ruby 184 and installed Ruby 186 and I get the
> same effect on this computer -- i.e. the Time.parse method is still
> not there by default.  Weird.  Could another Ruby gem be causing the
> problem?
>

Okay, I uninstalled Ruby again and reinstalled it. This time I wrote
a one-line script with the above Time.parse code so that I could run
it anytime.

I installed all the gems I needed and the Time.parse method is always
there and works as expected.

The one thing I did the last time that I *didn't* do this time was run
the command:
> gem update --system

If I run the above, then the Time.parse method will no longer be
available by default. It looks like there is something in that update
that kills the parse method for the Time class.

I won't be updating my rubygems again unless there is some compelling
reason for me to.

At least now I know what caused this system to stop running that
script.


Justin Collins

3/14/2009 2:53:00 AM

0

Paul Carvalho wrote:
>> As a test, I uninstalled Ruby 184 and installed Ruby 186 and I get the
>> same effect on this computer -- i.e. the Time.parse method is still
>> not there by default. Weird. Could another Ruby gem be causing the
>> problem?
>>
>>
>
> Okay, I uninstalled Ruby again and reinstalled it. This time I wrote
> a one-line script with the above Time.parse code so that I could run
> it anytime.
>
> I installed all the gems I needed and the Time.parse method is always
> there and works as expected.
>
> The one thing I did the last time that I *didn't* do this time was run
> the command:
>
>> gem update --system
>>
>
> If I run the above, then the Time.parse method will no longer be
> available by default. It looks like there is something in that update
> that kills the parse method for the Time class.
>
> I won't be updating my rubygems again unless there is some compelling
> reason for me to.
>
> At least now I know what caused this system to stop running that
> script.
>

Probably the newer version of one of your gems stopped including the
Time library.

-Justin

MS

2/7/2011 7:15:00 PM

0

Soon you'll get to the point where reaching DTR is no big deal. But
then you have to think about beating the DTR time the game remembers
for you! And the multiballs on the way to DTR... you'll start trying
to BEAT them, not just SURVIVE them.

And once DTR is no big deal to get to, you will find that you are
within striking range of completing all the modes to begin There And
Back Again.

And always, Valinor awaits... I have had my LOTR since 2004 and I
still haven't reached it. It may not be an exaggeration to say that
most owners have not.

Enjoy the journey!

Jeff Palmer

2/7/2011 8:04:00 PM

0

On Feb 7, 1:36 pm, Mick406 <mgior...@insightbb.com> wrote:
> Thanks everyone!!!  NOW I know the answer(s).  Yes, as one of you
> mentioned, I thought I had done it ALL already!  "Is this all there is
> to it??!!"
>
> Well, just destroying the ring is hard enough!  Now, I've got all that
> other 'work' to do??!!!!!!   I hope I can accomplish all this before I
> die!!! Ha.
>
> Last question out of curiosity (no patience here!) . . . . what
> happens when you do ALL of those things?  Does the machine go into the
> same IDENTICAL kind of frenzy on that first Destroy the Ring
> accomplishment?  Or, is there an even BIGGER surprise awaiting me?  I
> can't imagine anything even MORE frenetic than what I've already seen
> after DTR!!!
>
> And PLEASE . . . don't tell me it is in my own best interest to just
> WAIT and see what happens.  I'm 64 and may not have enough YEARS left
> to achieve this! Ha.
>
> Thanks again,
> Mike in Kentucky

Yes Valinor is a bigger event but the game does not go into chaos/
frenzy mode. Valinor is a relaxed event-in fact every now and then you
will hear some of the music after the game is over-very soothing, even
moreso than TABA.

And of course if you are that anxious, just take the glass off and set
it up-but that is no fun at all.

Enjoy your game!