[Rubygems-developers] Please test for a 1.3.1
luislavena at gmail.com
Tue Oct 21 17:09:33 EDT 2008
On Tue, Oct 21, 2008 at 6:07 PM, Berger, Daniel <Daniel.Berger at qwest.com> wrote:
>> >> Gem::location_of_caller is insufficient for windows paths :/
>> > How does this look?
>> > C:\>diff -u rubygems.orig rubygems.rb
>> > --- rubygems.orig Mon Sep 29 08:01:06 2008
>> > +++ rubygems.rb Tue Oct 21 14:29:27 2008
>> > @@ -479,8 +479,9 @@
>> > # The file name and line number of the caller of the
>> caller of this
>> > method.
>> > def self.location_of_caller
>> > - file, lineno = caller.split(':')
>> > - lineno = lineno.to_i
>> > + caller =~ /(.*?)\:(\d+)$/i
>> > + file = $1
>> > + lineno = $2.to_i
>> > [file, lineno]
>> > end
>> > Regards,
>> Bummer, you beat me, hate bad internet wireless connections...
>> I did something similar but one liner for Thor:
>> And of course, for the ones didn't noticed it, I suck at regexp :-P
> Mine is more verbose but less greedy. This better?
> def self.location_of_caller
> caller =~ /(.*?)\:(\d+)$/i
> [$1, $2.to_i] # file, lineno
Bytes are cheap nowdays :-)
I just was saying how lame my regexp skillz are :-P
I like more the first one, was more clear the intention of it and I
think Eric will agree, obscure code do not help you on the long run.
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
More information about the Rubygems-developers