[#253828] Getting the last N bytes of a string: — Brian Candler <B.Candler@...>

What's the simplest way to get only the last 10 bytes of a string?

21 messages 2007/06/01

[#253837] FizzBuzz (#126) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

177 messages 2007/06/01
[#253853] Re: [QUIZ] FizzBuzz (#126) — Hans Fugal <fugalh@...> 2007/06/01

Ruby Quiz wrote:

[#253854] Re: FizzBuzz (#126) — Paul Novak <novakps@...> 2007/06/01

On Jun 1, 9:51 am, Hans Fugal <fug...@zianet.com> wrote:

[#253885] Re: [QUIZ] FizzBuzz (#126) — Daniel Martin <martin@...> 2007/06/01

Hans Fugal <fugalh@zianet.com> writes:

[#253945] Re: [QUIZ] FizzBuzz (#126) — Morton Goldberg <m_goldberg@...> 2007/06/02

On Jun 1, 2007, at 8:28 AM, Ruby Quiz wrote:

[#254215] Re: [QUIZ] FizzBuzz (#126) — James Edward Gray II <james@...> 2007/06/04

On Jun 1, 2007, at 10:37 PM, Morton Goldberg wrote:

[#253969] Re: [QUIZ] FizzBuzz (#126) — Daniel Martin <martin@...> 2007/06/02

Ruby Quiz <james@grayproductions.net> writes:

[#254095] Re: [QUIZ] FizzBuzz (#126) — Michael Glaesemann <grzm@...> 2007/06/03

My first Ruby Quiz submission.

[#254096] Re: FizzBuzz (#126) — Joshua Ballanco <jballanc@...> 2007/06/03

So, I've got to lay claim to the 56 byte solution:

[#254097] Re: FizzBuzz (#126) — "Robert Dober" <robert.dober@...> 2007/06/03

On 6/3/07, Joshua Ballanco <jballanc@gmail.com> wrote:

[#254104] Re: FizzBuzz (#126) — Joshua Ballanco <jballanc@...> 2007/06/03

Robert Dober wrote:

[#253838] nested methods don't really exist?! — Artur Merke <am@...>

Hi,

28 messages 2007/06/01
[#253906] Re: nested methods don't really exist?! — Robert Klemme <shortcutter@...> 2007/06/01

On 01.06.2007 14:36, Artur Merke wrote:

[#253919] Re: nested methods don't really exist?! — Trans <transfire@...> 2007/06/01

[#253961] Re: nested methods don't really exist?! — Robert Klemme <shortcutter@...> 2007/06/02

On 01.06.2007 23:14, Trans wrote:

[#253967] Re: nested methods don't really exist?! — "Robert Dober" <robert.dober@...> 2007/06/02

On 6/2/07, Robert Klemme <shortcutter@googlemail.com> wrote:

[#253893] Help with emailing attachments with Ruby... — grooveska <ryangs@...>

I am working on a script that will send an email with a .csv file

11 messages 2007/06/01

[#254054] No way of looking for a regrexp match starting from a particular point in a string? — Kenneth McDonald <kenneth.m.mcdonald@...>

I'm probably just missing something obvious, but I haven't found a way

26 messages 2007/06/03
[#254056] Re: No way of looking for a regrexp match starting from a particular point in a string? — Nobuyoshi Nakada <nobu@...> 2007/06/03

Hi,

[#254059] Re: No way of looking for a regrexp match starting from a particular point in a string? — "Patrick Hurley" <phurley@...> 2007/06/03

On 6/3/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

[#254063] Re: No way of looking for a regrexp match starting from a particular point in a string? — Nobuyoshi Nakada <nobu@...> 2007/06/03

Hi,

[#254235] Re: No way of looking for a regrexp match starting from a particular point in a string? — "Robert Dober" <robert.dober@...> 2007/06/04

On 6/3/07, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:

[#254132] FizzBuzz (#126) — "Christian Roese" <croese@...>

Great quiz, really got me thinking about other ways to solve this

16 messages 2007/06/03
[#254277] Re: [QUIZ] FizzBuzz (#126) — "Mike Moore" <blowmage@...> 2007/06/04

I didn't spend any time golfing this quiz, so I don't have anything crazy to

[#254217] code problems — "david karapetyan" <dkarapetyan@...>

why is the following code not valid

18 messages 2007/06/04
[#254218] Re: code problems — Nobuyoshi Nakada <nobu@...> 2007/06/04

Hi,

[#254219] Re: code problems — "david karapetyan" <dkarapetyan@...> 2007/06/04

thanks. i didn't realize i had to provide the block as well when i was

[#254223] Re: code problems — Nobuyoshi Nakada <nobu@...> 2007/06/04

Hi,

[#254291] Re: code problems — fREW <frioux@...> 2007/06/04

On 6/3/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

[#254250] Deleting a file - is there a less clumsy way to do this? — "Ronald Fischer" <ronald.fischer@...>

In my application, I often have blocks of code, where during preparation

13 messages 2007/06/04

[#254332] Reverse-range alternatives? — Kenneth McDonald <kenneth.m.mcdonald@...>

Since a reverse range (eg. 4...1) is functionally almost the same as an

11 messages 2007/06/04

[#254452] David Black's book _Ruby for Rails — finetan@...

Hi all

16 messages 2007/06/05

[#254459] [QUIZ] FizzBuzz (#126) [solution #1] — MenTaLguY <mental@...>

I've got two solutions this go-round. First, the solution I would present were I asked to do this in an actual job interview:

13 messages 2007/06/05

[#254467] Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...>

Hello, I'm working on Gecode/R, a Ruby interface to Gecode[0], allowing

24 messages 2007/06/05
[#254477] Re: Gecode/R - Request for syntax feedback — James Edward Gray II <james@...> 2007/06/05

On Jun 5, 2007, at 2:43 PM, Andreas Launila wrote:

[#254526] Re: Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...> 2007/06/06

James Edward Gray II wrote:

[#254544] Re: Gecode/R - Request for syntax feedback — James Edward Gray II <james@...> 2007/06/06

On Jun 6, 2007, at 5:21 AM, Andreas Launila wrote:

[#254561] Re: Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...> 2007/06/06

James Edward Gray II wrote:

[#254583] Re: Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...> 2007/06/06

Andreas Launila wrote:

[#254639] Globals not incrementing inside block — "Todd A. Jacobs" <tjacobs-sndr-019fdb@...>

I have the following snippet:

13 messages 2007/06/07
[#254642] Re: Globals not incrementing inside block — "Harry Kakueki" <list.push@...> 2007/06/07

On 6/7/07, Todd A. Jacobs <tjacobs-sndr-019fdb@codegnome.org> wrote:

[#254661] Mutually-Recursive Functions — Revence Kalibwani <revence27@...>

Ruby doesn't seem to do mutually-recursive functions. Or is it some

15 messages 2007/06/07
[#254664] Re: Mutually-Recursive Functions — Dan Zwell <dzwell@...> 2007/06/07

Revence Kalibwani wrote:

[#254665] Re: Mutually-Recursive Functions — Revence Kalibwani <revence27@...> 2007/06/07

Dan Zwell wrote:

[#254673] What about a 'series' type? — Peter Marsh <evil_grunger@...>

I'm sure everyone is fimilar with ranges:

17 messages 2007/06/07
[#254685] Re: What about a 'series' type? — seebs@... (Peter Seebach) 2007/06/07

In message <cd08f63ca2ad51e567d4288410f593da@ruby-forum.com>, Peter Marsh writes:

[#254686] Re: What about a 'series' type? — SonOfLilit <sonoflilit@...> 2007/06/07

Actually, the syntax:

[#254717] Problem with getting info from several websites — "Tom Bombadil" <bombadil.tom@...>

Hi there,

14 messages 2007/06/07
[#254741] Re: Problem with getting info from several websites — George Malamidis <george@...> 2007/06/07

Hi,

[#254799] Re: Problem with getting info from several websites — "Tom Bombadil" <bombadil.tom@...> 2007/06/08

George,

[#254743] Installing Curb Was: Re: ruby libcurl maintainer? — "Jano Svitok" <jan.svitok@...>

On 6/7/07, Md.elme focruzzaman Shuvo <shuvo.razi@gmail.com> wrote:

11 messages 2007/06/07
[#254816] Installing Curb Was: Re: ruby libcurl maintainer? — "Md.elme focruzzaman Shuvo" <shuvo.razi@...> 2007/06/08

Jano Svitok wrote:

[#254808] newbie question about Ri — Grehom <grehom@...>

I just installed the latest Windows version from Activestate (having

13 messages 2007/06/08

[#254812] practical ruby console on windows? — =?iso-8859-2?q?Kiripolszky_K=E1roly?= <karoly.kiripolszky@...>

Ehlo,

5 messages 2007/06/08

[#254831] Mexican Blanket (#127) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

16 messages 2007/06/08

[#254863] Synchronized attr_accessor — Nasir Khan <rubylearner@...>

I have a fairly repetitive use case of having to define attributes and

23 messages 2007/06/08
[#254865] Re: Synchronized attr_accessor — MenTaLguY <mental@...> 2007/06/08

On Sat, 9 Jun 2007 04:34:42 +0900, Nasir Khan <rubylearner@gmail.com> wrote:

[#254867] Re: Synchronized attr_accessor — Nasir Khan <rubylearner@...> 2007/06/08

This is about having a instance variable always accessed under a lock,

[#254879] Re: Synchronized attr_accessor — MenTaLguY <mental@...> 2007/06/08

On Sat, 9 Jun 2007 04:55:24 +0900, Nasir Khan <rubylearner@gmail.com> wrote:

[#254886] Re: Synchronized attr_accessor — Nasir Khan <rubylearner@...> 2007/06/08

There is no big picture.

[#254890] Re: Synchronized attr_accessor — MenTaLguY <mental@...> 2007/06/08

On Sat, 9 Jun 2007 06:54:04 +0900, Nasir Khan <rubylearner@gmail.com> wrote:

[#254900] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/09

Yeah I see what you guys mean...I was a little delusional. Now I

[#254915] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/09

Actually facets/more/synchash.rb does what I was looking for hash.

[#254943] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/09

Prodding it further I could come up with a method synchronizer.

[#255049] Re: Synchronized attr_accessor — "Caleb Clausen" <vikkous@...> 2007/06/10

Nasir Khan wrote:

[#255073] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/11

Thanks for the feedback. Here is a refinement -

[#255093] Re: Synchronized attr_accessor — "Caleb Clausen" <vikkous@...> 2007/06/11

On 6/10/07, Nasir Khan <rubylearner@gmail.com> wrote:

[#254864] trouble running ruby programs — Hydro_Flame XZ18 <hydroflame@...>

I'm a newbie programmer and I just downloaded ruby today. I must say I'm

14 messages 2007/06/08
[#254866] Re: trouble running ruby programs — Peter Szinek <peter@...> 2007/06/08

> Can anyone help? I'm running Windows XP if that helps at all.

[#254870] Re: trouble running ruby programs — Jacob Gillie <hydroflame@...> 2007/06/08

I tried going to the command prompt, making sure the file was in the

[#254871] Re: trouble running ruby programs — "Michael W. Ryder" <_mwryder@...> 2007/06/08

Jacob Gillie wrote:

[#254917] Ruby wildcard command line argument auto expansion — Michael Jia <z_jia@...>

I want to pass in wildcard file names, and use it to match file names

14 messages 2007/06/09

[#254974] Passing block to Proc#call — "Erwin Abbott" <erwin.abbott@...>

I'd like to do something like:

13 messages 2007/06/10

[#254975] Overloading Array Subtraction operator — Nicko <anko.com@...>

Hi,

15 messages 2007/06/10
[#254978] Re: Overloading Array Subtraction operator — "Erwin Abbott" <erwin.abbott@...> 2007/06/10

The - operator compares objects by their ID, so they aren't removed

[#254986] JRuby 1.0 Released — Thomas Enebo <Thomas.Enebo@...>

The JRuby community is pleased to announce the release of JRuby 1.0!

14 messages 2007/06/10

[#254989] fun with "case" — Robert Klemme <shortcutter@...>

16 messages 2007/06/10

[#255013] Serious danger of being impressed — Mark Carter <me@...>

I'm mostly into Python, and decided to have a go at writing a little

34 messages 2007/06/10
[#255038] Re: Serious danger of being impressed — Chad Perrin <perrin@...> 2007/06/10

On Mon, Jun 11, 2007 at 12:20:12AM +0900, Mark Carter wrote:

[#255096] Re: Serious danger of being impressed — John Joyce <dangerwillrobinsondanger@...> 2007/06/11

[#255103] Re: Serious danger of being impressed — Chad Perrin <perrin@...> 2007/06/11

On Mon, Jun 11, 2007 at 03:42:03PM +0900, John Joyce wrote:

[#255044] Requiring more than one file? — Marc Heiler <shevegen@...>

require does accept ony word, which should be the name that has

13 messages 2007/06/10

[#255142] Custom Mutex methods undefined by fastthread — Alex Young <alex@...>

At the risk of asking an FAQ, I've run into the following problem:

12 messages 2007/06/11

[#255181] a matter of style — Bas van Gils <bas@...>

22 messages 2007/06/11
[#255188] Re: a matter of style — Anthony Martinez <pi@...> 2007/06/11

On Tue, Jun 12, 2007 at 03:10:49AM +0900, Bas van Gils wrote:

[#255299] Re: a matter of style — dblack@... 2007/06/12

Hi --

[#255202] Ruby way to update a file in place — Li Chen <chen_li3@...>

Hi all,

12 messages 2007/06/11

[#255258] how to make a[2][2][3]=4 work? — gz zz <gpygood@126.com>

a=Hash.new{|h,k|

16 messages 2007/06/12

[#255289] Generate a grid of cells, and give characteristics — Joop Van den tillaart <tillaart36@...>

Hi you all I am new to this forum and also quite new to ruby...I have

12 messages 2007/06/12
[#255303] Re: Generate a grid of cells, and give characteristics — "Harry Kakueki" <list.push@...> 2007/06/12

On 6/12/07, Joop Van den tillaart <tillaart36@hotmail.com> wrote:

[#255306] Re: Generate a grid of cells, and give characteristics — Joop Van den tillaart <tillaart36@...> 2007/06/12

Harry Kakueki wrote:

[#255315] Re: Generate a grid of cells, and give characteristics — "Harry Kakueki" <list.push@...> 2007/06/12

On 6/12/07, Joop Van den tillaart <tillaart36@hotmail.com> wrote:

[#255373] Quick sed replacemnt — yitzhakbg <yitzhakbg@...>

I need a quicky which I can't do in sed and I did it very clumsily.

14 messages 2007/06/12

[#255651] Changing registry values with Win32::Registry — Collin Miller <collintmiller@...>

I'm trying to change a registry value for an IPTV SDK

12 messages 2007/06/14
[#255699] Re: Changing registry values with Win32::Registry — "Jano Svitok" <jan.svitok@...> 2007/06/15

On 6/14/07, Collin Miller <collintmiller@gmail.com> wrote:> I'm trying to change a registry value for an IPTV SDK>> This code:>> Win32::Registry::HKEY_LOCAL_MACHINE.open("SOFTWARE\\PATH_TO_KEY\> \").write("IgnoreTinyIFrames",Win32::Registry::REG_DWORD,0)>> Returns this error:>> Win32::Registry::Error: Access is denied.> from c:/ruby/lib/ruby/1.8/win32/registry.rb:743:in `write'> from (irb):150> from ⊂:0>> Anybody know how I can ensure access to this key?

[#255664] Reasonable practice? — Trans <transfire@...>

It the following reasonable? How thread safe is it?

14 messages 2007/06/14

[#255672] Re: class destruction (evil genius metaprogramming) — "Rick DeNatale" <rick.denatale@...>

On 6/14/07, Giles Bowkett <gilesb@gmail.com> wrote:

12 messages 2007/06/15

[#255737] Verbal Arithmetic (#128) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

29 messages 2007/06/15

[#255760] Using extend for initialization settings? — Trans <transfire@...>

It's not uncommon to see initialize method take a hash or a setting

16 messages 2007/06/15
[#255784] Re: Using extend for initialization settings? — Robert Klemme <shortcutter@...> 2007/06/15

On 15.06.2007 16:44, Trans wrote:

[#255797] Re: Using extend for initialization settings? — Trans <transfire@...> 2007/06/15

[#255864] Adding new value (in array) to existing key in a hash — Gilbert Lau <gilbertlsk@...>

Hi all,

12 messages 2007/06/16
[#255866] Re: Adding new value (in array) to existing key in a hash — "Harry Kakueki" <list.push@...> 2007/06/16

On 6/16/07, Gilbert Lau <gilbertlsk@gmail.com> wrote:

[#255873] Re: Adding new value (in array) to existing key in a hash — Gilbert Lau <gilbertlsk@...> 2007/06/16

Harry Kakueki wrote:

[#255871] Error in ancestor? — "Robert Dober" <robert.dober@...>

Hi list

39 messages 2007/06/16
[#256036] Re: Error in ancestor? — Sylvain Joyeux <sylvain.joyeux@...> 2007/06/18

I launched a discussion about this on Ruby-core. I think there were no

[#256193] Re: Error in ancestor? — "Robert Dober" <robert.dober@...> 2007/06/19

On 6/18/07, Sylvain Joyeux <sylvain.joyeux@polytechnique.org> wrote:

[#256204] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/19

On 6/19/07, Robert Dober <robert.dober@gmail.com> wrote:

[#256236] Re: Error in ancestor? — dblack@... 2007/06/19

Hi --

[#256486] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/21

On 6/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256492] Re: Error in ancestor? — dblack@... 2007/06/21

Hi --

[#256594] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/22

On 6/21/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256595] Re: Error in ancestor? — dblack@... 2007/06/22

Hi --

[#256598] Re: Error in ancestor? — "Gregory Brown" <gregory.t.brown@...> 2007/06/22

On 6/22/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256700] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/23

On 6/22/07, Gregory Brown <gregory.t.brown@gmail.com> wrote:

[#255911] Chris Pine Program Challenges — danielj@...

puts 'Type in as many words as you want'

13 messages 2007/06/16

[#255980] Parsing strings — NB88 <germans88@...>

Quick question, is there a method for deleting substrings from within a

15 messages 2007/06/18

[#256062] Another Easy Beginner Question — danielj <danielj@...>

17 messages 2007/06/18

[#256131] local vars clobbered by un-run code — Trans <transfire@...>

Err...

13 messages 2007/06/19

[#256243] Ruby MVC — poopdeville@...

Hi Everybody,

14 messages 2007/06/20

[#256299] Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...>

Hello everybody,

55 messages 2007/06/20
[#256311] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Trans <transfire@...> 2007/06/20

[#256357] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

>> Hello everybody,

[#256361] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Robert Klemme <shortcutter@...> 2007/06/21

On 21.06.2007 11:06, Alexander Presber wrote:

[#256364] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

Am 21.06.2007 um 11:20 schrieb Robert Klemme:

[#256365] Re: Behaviour of Enumerables reject vs. select mixed into Hash — dblack@... 2007/06/21

Hi --

[#256367] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Robert Dober" <robert.dober@...> 2007/06/21

On 6/21/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256370] Re: Behaviour of Enumerables reject vs. select mixed into Hash — dblack@... 2007/06/21

Hi --

[#256498] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Rick DeNatale" <rick.denatale@...> 2007/06/21

On 6/21/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256369] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

[#256374] Re: Behaviour of Enumerables reject vs. select mixed into Hash — dblack@... 2007/06/21

Hi --

[#256377] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

[#256385] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Robert Dober" <robert.dober@...> 2007/06/21

On 6/21/07, Alexander Presber <aljoscha@weisshuhn.de> wrote:

[#256401] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Trans <transfire@...> 2007/06/21

[#256414] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Robert Dober" <robert.dober@...> 2007/06/21

On 6/21/07, Trans <transfire@gmail.com> wrote:

[#256423] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

>> module Enumerable

[#256310] Do You Understand Regular Expressions? — growlatoe@...

Hi all.

20 messages 2007/06/20
[#256317] Re: Do You Understand Regular Expressions? — "Axel Etzold" <AEtzold@...> 2007/06/20

> irb(main):001:0> "hello".scan(/.*/)

[#256324] Re: Do You Understand Regular Expressions? — Daniel DeLorme <dan-ml@...42.com> 2007/06/20

Axel Etzold wrote:

[#256386] Re: Do You Understand Regular Expressions? — "Stephen Ball" <sdball@...> 2007/06/21

On 6/20/07, Daniel DeLorme <dan-ml@dan42.com> wrote:

[#256426] Ruby extensions question.. — Aaron Smith <beingthexemplary@...>

So I'm getting slightly confused with writing ruby extensions and what

17 messages 2007/06/21
[#256430] Re: Ruby extensions question.. — james.d.masters@... 2007/06/21

On Jun 21, 10:22 am, Aaron Smith <beingthexempl...@gmail.com> wrote:

[#256442] Re: Ruby extensions question.. — Aaron Smith <beingthexemplary@...> 2007/06/21

unknown wrote:

[#256450] Re: Ruby extensions question.. — MenTaLguY <mental@...> 2007/06/21

On Fri, 22 Jun 2007 03:55:11 +0900, Aaron Smith <beingthexemplary@gmail.com> wrote:

[#256469] Re: Ruby extensions question.. — Aaron Smith <beingthexemplary@...> 2007/06/21

MenTaLguY wrote:

[#256473] Re: Ruby extensions question.. — MenTaLguY <mental@...> 2007/06/21

On Fri, 22 Jun 2007 05:28:17 +0900, Aaron Smith <beingthexemplary@gmail.com> wrote:

[#256447] Ruby doesn't know how to multiply — "rjprado@..." <rjprado@...>

Hello,

45 messages 2007/06/21
[#256462] Re: Ruby doesn't know how to multiply — "rjprado@..." <rjprado@...> 2007/06/21

On Jun 21, 3:21 pm, "rjpr...@gmail.com" <rjpr...@gmail.com> wrote:

[#256484] Re: Ruby doesn't know how to multiply — Lloyd Linklater <lloyd@2live4.com> 2007/06/21

> Yes, you are all right. It's a common problem. I have confirmed this

[#256509] Re: Ruby doesn't know how to multiply — Yukihiro Matsumoto <matz@...> 2007/06/22

Hi,

[#256512] Re: Ruby doesn't know how to multiply — "Michael W. Ryder" <_mwryder@...> 2007/06/22

Yukihiro Matsumoto wrote:

[#256514] Re: Ruby doesn't know how to multiply — "Gregory Brown" <gregory.t.brown@...> 2007/06/22

On 6/21/07, Michael W. Ryder <_mwryder@worldnet.att.net> wrote:

[#256517] Re: Ruby doesn't know how to multiply — Rob Biedenharn <Rob@...> 2007/06/22

On Jun 21, 2007, at 8:48 PM, Gregory Brown wrote:

[#256519] Re: Ruby doesn't know how to multiply — "Michael W. Ryder" <_mwryder@...> 2007/06/22

Rob Biedenharn wrote:

[#256556] avoiding nil.methodcalls short and cheap — Thorsten Rossner <rossnet@...>

Hi,

17 messages 2007/06/22

[#256675] Regexp to split name? — Alex MacCaw <maccman@...>

Does anyone have an example of splitting a name into first and last

15 messages 2007/06/23
[#256676] Re: Regexp to split name? — darren kirby <bulliver@...> 2007/06/23

quoth the Alex MacCaw:

[#256713] Named/positional method args — darren kirby <bulliver@...>

I have a method here that takes two arguments. Both are optional, with

19 messages 2007/06/23

[#256748] LSRC Name Picker (#129) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

44 messages 2007/06/24
[#256749] Re: [QUIZ] LSRC Name Picker (#129) — James Edward Gray II <james@...> 2007/06/24

Sorry the quiz was late this week.

[#256811] Helper to create multi-dimensional arrays — Anthony Martinez <pi@...>

I came up with this method really quick to create x*y arrays in Ruby. It

21 messages 2007/06/24
[#256816] Ruby Debugger — Dick Summerfield <ds@...> 2007/06/24

Hello everybody,

[#257017] Probably an FAQ, but... — David Rush <kumoyuki@...>

Hi all,

13 messages 2007/06/26
[#257023] Re: Probably an FAQ, but... — Morton Goldberg <m_goldberg@...> 2007/06/26

On Jun 26, 2007, at 5:00 AM, David Rush wrote:

[#257033] how much to charge for a freelance project in ruby in the states — urielka <uriel.katz@...>

i work in Israel and i wanted to know how much should i charge per

9 messages 2007/06/26

[#257207] ActiveRecord (not necessarily rails) — "shawn bright" <nephish@...>

Hello all,

11 messages 2007/06/27

[#257228] Ajax with Ruby problem — Gale CC <galecho@...>

I'm a newbie to both Ruby and Ajax. I'm trying to use Ruby to handle the

13 messages 2007/06/27

[#257246] Array Problem, sort Array — Cool Wong <coolwong85@...>

[code]

23 messages 2007/06/28
[#257248] Re: Array Problem, sort Array — "list. rb" <list.rb@...> 2007/06/28

["a", "a", "a", "b", "b", "c", "c", "c","d", "d", "e"].uniq.sort

[#257342] Help with regular expression — "toulax@..." <toulax@...>

How can I make a regular expression that will match everything, unless

17 messages 2007/06/28
[#257343] Re: Help with regular expression — Philip Hallstrom <ruby@...> 2007/06/28

> How can I make a regular expression that will match everything, unless

[#257346] Re: Help with regular expression — "toulax@..." <toulax@...> 2007/06/28

On Jun 28, 4:00 pm, Philip Hallstrom <r...@philip.pjkh.com> wrote:

[#257353] Re: Help with regular expression — "Axel Etzold" <AEtzold@...> 2007/06/28

I think what you want is what's called negative lookahead.

[#257383] newby non/programmer trying to understand classes — "weathercoach@..." <weathercoach@...>

Hello.

15 messages 2007/06/28

[#257428] Where to start in parsing? — "Hakusa@..." <Hakusa@...>

I haven't programmed in a while, but I want to get back with doing

10 messages 2007/06/29

[#257454] Feature Request: Special file '-' denoting stdin/stdout — "Ronald Fischer" <ronald.fischer@...>

I would like to propose a feature for Ruby which can be

12 messages 2007/06/29
[#257471] Re: Feature Request: Special file '-' denoting stdin/stdout — Erik Veenstra <erikveen@...> 2007/06/29

It should be mentioned that both File.new and File.open are

[#257746] Re: Feature Request: Special file '-' denoting stdin/stdout — "Ronald Fischer" <ronald.fischer@...> 2007/07/02

[#257573] is it bug? for — Chung Chung <bkeh12@...>

[root@home1 ~]# ruby -v

16 messages 2007/06/30

[#257601] de-camelcase a filename — Aaron Smith <beingthexemplary@...>

how can a take a string file name like MyTestCase.rb and change it to

15 messages 2007/06/30

[#257609] apt-get installs 1.8.5 on ubuntu 7.0.4 — "D. Krmpotic" <david.krmpotic@...>

hi!

11 messages 2007/06/30

Re: tengo problemas con el ruby error.rb

From: "Daniel Sánchez" <daniels171@...>
Date: 2007-06-03 01:43:59 UTC
List: ruby-talk #254047
Acabo de actualizar el Rubygem 0.9.0 al 0.9.4 con "gem update --system"
ahora ya tengo el rubygems 0.9.4 corregi el error del require que me 
dijiste y ahora aparece este error

=================================================================================
Launched AGI Script /var/lib/asterisk/agi-bin/comprobar-festivos.rb
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:84:Warning: require_gem is 
obsolete.  Use gem instead.
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:76:in `active_gem_with_options': 
undefined method `activate' for Gem:Module (NoMethodError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:61:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:84
        from /var/lib/asterisk/agi-bin/comprobar-festivos.rb:17:in 
`require'
        from /var/lib/asterisk/agi-bin/comprobar-festivos.rb:17
    -- AGI Script comprobar-festivos.rb completed, returning 0
================================================================================
que puedo hacer y el nuevo rubygems.rb es e siguiente
================================================================================
#!/usr/bin/env ruby
# -*- ruby -*-

#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

require 'rbconfig'

module Gem
  class LoadError < ::LoadError
    attr_accessor :name, :version_requirement
  end
end

module Kernel

  # Adds a Ruby Gem to the $LOAD_PATH.  Before a Gem is loaded, its
  # required Gems are loaded.  If the version information is omitted,
  # the highest version Gem of the supplied name is loaded.  If a Gem
  # is not found that meets the version requirement and/or a required
  # Gem is not found, a Gem::LoadError is raised. More information on
  # version requirements can be found in the Gem::Version
  # documentation.
  #
  # The +gem+ directive should be executed *before* any require
  # statements (otherwise rubygems might select a conflicting library
  # version).
  #
  # You can define the environment variable GEM_SKIP as a way to not
  # load specified gems.  you might do this to test out changes that
  # haven't been intsalled yet.  Example:
  #
  #   GEM_SKIP=libA:libB ruby-I../libA -I../libB ./mycode.rb
  #
  # gem:: [String or Gem::Dependency] The gem name or dependency
  #       instance.
  #
  # version_requirement:: [default=">= 0.0.0"] The version
  #                       requirement.
  #
  # return:: [Boolean] true if the Gem is loaded, otherwise false.
  #
  # raises:: [Gem::LoadError] if Gem cannot be found, is listed in
  #          GEM_SKIP, or version requirement not met.
  #
  def gem(gem_name, *version_requirements)
    active_gem_with_options(gem_name, version_requirements)
  end

  # Same as the +gem+ command, but will also require a file if the gem
  # provides an auto-required file name.
  #
  # DEPRECATED!  Use +gem+ instead.
  #
  def require(gem_name, *version_requirements)
    file, lineno = location_of_caller
    warn "#{file}:#{lineno}:Warning: require_gem is obsolete.  Use gem 
instead."
    active_gem_with_options(gem_name, version_requirements, 
:auto_require=>true)
  end

  # Return the file name (string) and line number (integer) of the 
caller of
  # the caller of this method.
  def location_of_caller
    file, lineno = caller[1].split(':')
    lineno = lineno.to_i
    [file, lineno]
  end
  private :location_of_caller

  def active_gem_with_options(gem_name, version_requirements, 
options={})
    skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
    raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? 
gem_name
    Gem.activate(gem_name, options[:auto_require], 
*version_requirements)
  end
  private :active_gem_with_options
end

# Main module to hold all RubyGem classes/modules.
#
module Gem
  require 'rubygems/rubygems_version.rb'
  require 'thread'

  MUTEX = Mutex.new

  class Exception < RuntimeError
  end

  class OperationNotSupportedError < Gem::Exception
  end

  RubyGemsPackageVersion = RubyGemsVersion

  DIRECTORIES = ['cache', 'doc', 'gems', 'specifications']

  @@source_index = nil

  @configuration = nil
  @loaded_specs = {}

  class << self

    attr_reader :loaded_specs

    def manage_gems
      require 'rubygems/user_interaction'
      require 'rubygems/builder'
      require 'rubygems/format'
      require 'rubygems/remote_installer'
      require 'rubygems/installer'
      require 'rubygems/validator'
      require 'rubygems/doc_manager'
      require 'rubygems/command_manager'
      require 'rubygems/gem_runner'
      require 'rubygems/config_file'
    end

    # Returns an Cache of specifications that are in the Gem.path
    #
    # return:: [Gem::SourceIndex] Index of installed Gem::Specifications
    #
    def source_index
      @@source_index ||= SourceIndex.from_installed_gems
    end

    # Provide an alias for the old name.
    alias cache source_index

    # The directory path where Gems are to be installed.
    #
    # return:: [String] The directory path
    #
    def dir
      @gem_home ||= nil
      set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
      @gem_home
    end

    # The directory path where executables are to be installed.
    #
    def bindir(install_dir=Gem.dir)
      return File.join(install_dir, 'bin') unless install_dir == 
Gem.default_dir

      if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
        File.join(File.dirname(Config::CONFIG["sitedir"]),
                  File.basename(Config::CONFIG["bindir"]))
      else # generic install
        Config::CONFIG['bindir']
      end
    end

    # List of directory paths to search for Gems.
    #
    # return:: [List<String>] List of directory paths.
    #
    def path
      @gem_path ||= nil
      set_paths(ENV['GEM_PATH']) unless @gem_path
      @gem_path
    end

    # The home directory for the user.
    def user_home
      @user_home ||= find_home
    end

    # Return the path to standard location of the users .gemrc file.
    def config_file
      File.join(Gem.user_home, '.gemrc')
    end

    # The standard configuration object for gems.
    def configuration
      return @configuration if @configuration

      @configuration = {}
      class << @configuration
        undef_method :verbose # HACK RakeFileUtils pollution
      end if @configuration.respond_to? :verbose

      def @configuration.method_missing(sym, *args, &block)
        if args.empty?
          self[sym]
        else
          super
        end
      end

      @configuration
    end

    # Use the given configuration object (which implements the
    # ConfigFile protocol) as the standard configuration object.
    def configuration=(config)
      @configuration = config
    end

    # Return the path the the data directory specified by the gem
    # name.  If the package is not available as a gem, return nil.
    def datadir(gem_name)
      spec = @loaded_specs[gem_name]
      return nil if spec.nil?
      File.join(spec.full_gem_path, 'data', gem_name)
    end

    # Return the searcher object to search for matching gems.
    def searcher
      MUTEX.synchronize do
        @searcher ||= Gem::GemPathSearcher.new
      end
    end

    # Return the Ruby command to use to execute the Ruby interpreter.
    def ruby
      "ruby"
    end

    # Activate a gem (i.e. add it to the Ruby load path).  The gem
    # must satisfy all the specified version constraints.  If
    # +autorequire+ is true, then automatically require the specified
    # autorequire file in the gem spec.
    #
    # Returns true if the gem is loaded by this call, false if it is
    # already loaded, or an exception otherwise.
    #
    def activate(gem, autorequire, *version_requirements)
      unless version_requirements.size > 0
        version_requirements = [">= 0.0.0"]
      end
      unless gem.respond_to?(:name) && 
gem.respond_to?(:version_requirements)
        gem = Gem::Dependency.new(gem, version_requirements)
      end

      matches = Gem.source_index.find_name(gem.name, 
gem.version_requirements)
      report_activate_error(gem) if matches.empty?

      if @loaded_specs[gem.name]
        # This gem is already loaded.  If the currently loaded gem is
        # not in the list of candidate gems, then we have a version
        # conflict.
        existing_spec = @loaded_specs[gem.name]
        if ! matches.any? { |spec| spec.version == existing_spec.version 
}
          fail Gem::Exception, "can't activate #{gem}, already activated 
#{existing_spec.full_name}]"
        end
        return false
      end

      # new load
      spec = matches.last
      if spec.loaded?
        return false unless autorequire
        result = spec.autorequire ? require(spec.autorequire) : false
        return result || false
      end

      spec.loaded = true
      @loaded_specs[spec.name] = spec

      # Load dependent gems first
      spec.dependencies.each do |dep_gem|
        activate(dep_gem, autorequire)
      end

      # bin directory must come before library directories
      spec.require_paths.unshift spec.bindir if spec.bindir

      require_paths = spec.require_paths.map do |path|
        File.join spec.full_gem_path, path
      end

      sitelibdir = Config::CONFIG['sitelibdir']

      # gem directories must come after -I and ENV['RUBYLIB']
      $:.insert($:.index(sitelibdir), *require_paths)

      # Now autorequire
      if autorequire && spec.autorequire then # DEPRECATED
        Array(spec.autorequire).each do |a_lib|
          require a_lib
        end
      end

      return true
    end

    # Report a load error during activation.  The message of load
    # error depends on whether it was a version mismatch or if there
    # are not gems of any version by the requested name.
    def report_activate_error(gem)
      matches = Gem.source_index.find_name(gem.name)
      if matches.size==0
        error = Gem::LoadError.new(
          "Could not find RubyGem #{gem.name} 
(#{gem.version_requirements})\n")
      else
        error = Gem::LoadError.new(
          "RubyGem version error: " +
          "#{gem.name}(#{matches.first.version} not 
#{gem.version_requirements})\n")
      end
      error.name = gem.name
      error.version_requirement = gem.version_requirements
      raise error
    end
    private :report_activate_error

    # Reset the +dir+ and +path+ values.  The next time +dir+ or +path+
    # is requested, the values will be calculated from scratch.  This is
    # mainly used by the unit tests to provide test isolation.
    #
    def clear_paths
      @gem_home = nil
      @gem_path = nil
      @@source_index = nil
    end

    # Use the +home+ and (optional) +paths+ values for +dir+ and +path+.
    # Used mainly by the unit tests to provide environment isolation.
    #
    def use_paths(home, paths=[])
      clear_paths
      set_home(home) if home
      set_paths(paths.join(File::PATH_SEPARATOR)) if paths
    end

    # Return a list of all possible load paths for all versions for
    # all gems in the Gem installation.
    #
    def all_load_paths
      result = []
      Gem.path.each do |gemdir|
        each_load_path(all_partials(gemdir)) do |load_path|
          result << load_path
        end
      end
      result
    end

    # Return a list of all possible load paths for the latest version
    # for all gems in the Gem installation.
    def latest_load_paths
      result = []
      Gem.path.each do |gemdir|
        each_load_path(latest_partials(gemdir)) do |load_path|
          result << load_path
        end
      end
      result
    end

    def required_location(gemname, libfile, *version_constraints)
      version_constraints = [">0"] if version_constraints.empty?
      matches = Gem.source_index.find_name(gemname, version_constraints)
      return nil if matches.empty?
      spec = matches.last
      spec.require_paths.each do |path|
        result = File.join(spec.full_gem_path, path, libfile)
        return result if File.exists?(result)
      end
      nil
    end

    def suffixes
      ['', '.rb', '.rbw', '.so', '.bundle', '.dll', '.sl', '.jar']
    end

    def suffix_pattern
      @suffix_pattern ||= "{#{suffixes.join(',')}}"
    end

    private

    # Return all the partial paths in the given +gemdir+.
    def all_partials(gemdir)
      Dir[File.join(gemdir, 'gems/*')]
    end

    # Return only the latest partial paths in the given +gemdir+.
    def latest_partials(gemdir)
      latest = {}
      all_partials(gemdir).each do |gp|
        base = File.basename(gp)
        matches = /(.*)-((\d+\.)*\d+)/.match(base)
        name, version = [matches[1], matches[2]]
        ver = Gem::Version.new(version)
        if latest[name].nil? || ver > latest[name][0]
          latest[name] = [ver, gp]
        end
      end
      latest.collect { |k,v| v[1] }
    end

    # Expand each partial gem path with each of the required paths
    # specified in the Gem spec.  Each expanded path is yielded.
    def each_load_path(partials)
      partials.each do |gp|
        base = File.basename(gp)
        specfn = File.join(dir, "specifications", base + ".gemspec")
        if File.exist?(specfn)
          spec = eval(File.read(specfn))
          spec.require_paths.each do |rp|
            yield(File.join(gp, rp))
          end
        else
          filename = File.join(gp, 'lib')
          yield(filename) if File.exist?(filename)
        end
      end
    end

    # Set the Gem home directory (as reported by +dir+).
    def set_home(home)
      @gem_home = home
      ensure_gem_subdirectories(@gem_home)
    end

    # Set the Gem search path (as reported by +path+).
    def set_paths(gpaths)
      if gpaths
        @gem_path = gpaths.split(File::PATH_SEPARATOR)
        @gem_path << Gem.dir
      else
        @gem_path = [Gem.dir]
      end
      @gem_path.uniq!
      @gem_path.each do |gp| ensure_gem_subdirectories(gp) end
    end

    # Some comments from the ruby-talk list regarding finding the home
    # directory:
    #
    #   I have HOME, USERPROFILE and HOMEDRIVE + HOMEPATH. Ruby seems
    #   to be depending on HOME in those code samples. I propose that
    #   it should fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at
    #   least on Win32).
    #
    def find_home
      ['HOME', 'USERPROFILE'].each do |homekey|
        return ENV[homekey] if ENV[homekey]
      end
      if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
        return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
      end
      begin
        File.expand_path("~")
      rescue StandardError => ex
        if File::ALT_SEPARATOR
          "C:/"
        else
          "/"
        end
      end
    end

    public

    # Default home directory path to be used if an alternate value is
    # not specified in the environment.
    def default_dir
      if defined? RUBY_FRAMEWORK_VERSION
        return File.join(File.dirname(Config::CONFIG["sitedir"]), 
"Gems")
      else
        File.join(Config::CONFIG['libdir'], 'ruby', 'gems', 
Config::CONFIG['ruby_version'])
      end
    end

    private

    # Quietly ensure the named Gem directory contains all the proper
    # subdirectories.  If we can't create a directory due to a
    # permission problem, then we will silently continue.
    def ensure_gem_subdirectories(gemdir)
      DIRECTORIES.each do |filename|
        fn = File.join(gemdir, filename)
        unless File.exist?(fn)
          require 'fileutils'
          FileUtils.mkdir_p(fn) rescue nil
        end
      end
    end

  end
end


# Modify the non-gem version of datadir to handle gem package names.

require 'rbconfig/datadir'
module Config # :nodoc:
  class << self
    alias gem_original_datadir datadir

    # Return the path to the data directory associated with the named
    # package.  If the package is loaded as a gem, return the gem
    # specific data directory.  Otherwise return a path to the share
    # area as define by "#{Config::CONFIG['datadir']}/#{package_name}".
    def datadir(package_name)
      Gem.datadir(package_name) || 
Config.gem_original_datadir(package_name)
    end
  end
end

require 'rubygems/source_index'
require 'rubygems/specification'
require 'rubygems/security'
require 'rubygems/version'
require 'rubygems/custom_require'

-- 
Posted via http://www.ruby-forum.com/.

In This Thread

Prev Next