Overriding Object#clone vs. Overriding Object#dup for Deep-Cloning

2012-09-19 Thread Yaser Sulaiman
Hi. Is there a community convention that specifies which of the two methods, `Object#clone` and `Object#dup`, should be overridden for the purposes of deep-cloning? On Stackoverflow, some say that `clone` should be overridden [1], while others say that `dup` is the method to be overridden [2]. So

Re: Ruby - is it worth the effort?

2012-09-19 Thread Robert Klemme
On Wed, Sep 19, 2012 at 2:40 PM, Roger Pack wrote: >> Being a Ruby shop we try to use Ruby everywhere but when it does come >> to grinding through logfiles (some several gigs in size) we had to go >> with Perl. The string processing and regex matching was so much >> faster. We couldn't get Ruby ev

Re: Ruby - is it worth the effort?

2012-09-19 Thread Robert Klemme
On Wed, Sep 19, 2012 at 1:29 PM, Robert Klemme wrote: PS: Here's probably a even more rubyesce solution - albeit not faster $ cat ruby-8.rb #!/usr/bin/env ruby f = 'FRED' puts File.foreach("results201101.dat").count {|line| line.include? f} -- remember.guy do |as, often| as.you_can - withou

Re: Ruby - is it worth the effort?

2012-09-19 Thread Robert Klemme
On Wed, Sep 19, 2012 at 11:41 AM, Peter Hickman wrote: > On 19 September 2012 10:09, Carlos Agarie wrote: >> I'd like to know, too. I stumbled upon a similar problem, but it was long >> ago. > > Ok here is a quick test that I hacked up. The data is a 2,659,800 line > 639Mb text file. Some lines c

Re: Ruby - is it worth the effort?

2012-09-19 Thread Robert Klemme
On Wed, Sep 19, 2012 at 10:36 AM, Peter Hickman wrote: > On 19 September 2012 09:24, Robert Klemme wrote: >> On Mon, Sep 17, 2012 at 8:20 PM, Peter Zotov >> wrote: >>> That being said, I won't write number crunching algorithms in Ruby, or work >>> with gigabyte-sized datasets. >> >> Well, even

Re: Class variables

2012-09-19 Thread Robert Klemme
On Tue, Sep 18, 2012 at 12:07 PM, Aleksander Ciesielski wrote: > Is it obligatory to use instance variables in classes? Can't we just write > something like this: > > class Test > var = 5 > > def show > puts var > end > end > > test = Test.new > test.show > p test.var You can

Re: Ruby - is it worth the effort?

2012-09-19 Thread Robert Klemme
On Mon, Sep 17, 2012 at 8:20 PM, Peter Zotov wrote: > Roger Pack писал 17.09.2012 22:06: > >> So basically if you're ok with a "somewhat slow" end product, Ruby is >> still grand, because programming in it is funner. > > I want to note that there isn't a general measure for slowness. Is it > fast