[#688] mkmf.rb - add files to clean and distclean targets — Michal Rokos <michal@...>

Hi,

25 messages 2003/01/15
[#722] Re: [RFC] mkmf.rb - add files to clean and distclean targets — Mathieu Bouchard <matju@...> 2003/01/20

On Thu, 16 Jan 2003, Michal Rokos wrote:

[#740] Re: [RFC] mkmf.rb - add files to clean and distclean targets — matz@... (Yukihiro Matsumoto) 2003/01/21

Hi,

[#724] Symbols: More Functionality Wanted — Ryan Pavlik <rpav@...>

I've been discussing this for a bit on #ruby-lang on OPN (or freenode or

23 messages 2003/01/20
[#728] Re: Symbols: More Functionality Wanted — matz@... (Yukihiro Matsumoto) 2003/01/20

Hi,

[#743] Re: Symbols: More Functionality Wanted — "Pit Capitain" <pit@...> 2003/01/21

On 20 Jan 2003 at 15:49, Yukihiro Matsumoto wrote:

[#767] Re: Symbols: More Functionality Wanted — Mathieu Bouchard <matju@...> 2003/01/22

[#768] Re: Symbols: More Functionality Wanted — dblack@... 2003/01/22

Hi --

[#779] Re: Symbols: More Functionality Wanted — Gavin Sinclair <gsinclair@...> 2003/01/23

On Thursday, January 23, 2003, 6:28:04 AM, dblack wrote:

Extensions for Time and ParseDate

From: Ryan Davis <ryand-ruby@...>
Date: 2003-01-22 04:23:15 UTC
List: ruby-core #757
Eric and I have been hacking around and we can't stand the lack of 
interoperability between Time and ParseDate. We think that one should 
be able to feed the other. We've hacked up the following code (and 
tests!) and would like to see this added if possible. The only thing I 
don't like about this code is that we drop off the timezone argument 
from parsedate. I'm not sure what to do about that, as I don't know how 
to adjust the generated time by the right amount of offset. If someone 
could come up with that, it would be a huge benefit.

Thanks.

class Time
   def Time.str2local(str)
     self.local(*ParseDate.better(str))
   end
   def Time.str2gm(str)
     self.gm(*ParseDate.better(str))
   end
end

module ParseDate
   def ParseDate.better(str)
     result = ParseDate.parsedate(str).map { |x| x.nil? ? 0 : x}
     result[0..-2]
   end
end

require 'parsedate'
require 'test/unit'

class TestParseDateBetter < Test::Unit::TestCase
   def test_bottom_up
     result = ParseDate.better("1975-11-10 T13:45")
     assert_equal([1975, 11, 10, 13, 45, 0, 0],
		 result,
		 "Array must be the correct args for Time.local")
   end
   def test_top_down
     result = Time.str2local("1975-11-10 T13:45")
     assert_equal(Time.local(1975, 11, 10, 13, 45, 0, 0),
		 result,
		 "Must return the correct time straight up")
   end
end


In This Thread

Prev Next