[Rails] Re: Re: Concatenate two arrays

2013-08-29 Thread Alex Froelich
Frederick Cheung wrote in post #1120015: > On Thursday, August 29, 2013 11:02:10 PM UTC+1, Ruby-Forum.com User > wrote: >> > Dheeraj's code has optional arguments. In such circumstances arity will > return a negative number (where -1 means that the method requires at > least > 0 arguments, -1 would

[Rails] Re: Re: Concatenate two arrays

2013-08-29 Thread Frederick Cheung
On Thursday, August 29, 2013 11:02:10 PM UTC+1, Ruby-Forum.com User wrote: > > > The code for the number of arguments and the part which is failing is > > > it "requires two arguments" do > method(:array_sum).arity.should eq 2 > end > > > Dheeraj's code has optional arguments. In such

Re: [Rails] Re: Re: Concatenate two arrays

2013-08-29 Thread Dheeraj Kumar
The arity should be -1, not 2. See the docs here: http://www.ruby-doc.org/core-1.9.3/Method.html#method-i-arity I read the pickaxe book about three years ago, when I first started with Ruby 1.9.2. It was quite beginner friendly, and very useful. I haven't read more recent editions. -- Dheera

[Rails] Re: Re: Concatenate two arrays

2013-08-29 Thread Alex Froelich
Dheeraj Kumar wrote in post #1120004: > Could you paste your test? > > -- > Dheeraj Kumar The code for the number of arguments and the part which is failing is it "requires two arguments" do method(:array_sum).arity.should eq 2 end Thanks Dheeraj. Quick question about the pick axe boo