Ruby on Rails Sunday, October 30, 2011

thanks for responses, it makes sense that it failed, because the each
iterator is only intended to iterate over one object at a time. I need
more time of my own to investigate a better way to do this.

On Oct 29, 2:28 pm, Dave Aronson <googlegroups2d...@davearonson.com>
wrote:
> On Sat, Oct 29, 2011 at 00:09, John Merlino <stoici...@aol.com> wrote:
> > ruby-1.9.2-p136 :095 > portfolio.each {|n, b| n <=> b }
> > NoMethodError: undefined method `balance' for nil:NilClass
>
> > It appears that the each iterator does not support passing in two
> > arguments?
>
> Correct.  "each" means "apply this block to each of this collection's
> elements in turn", not "... in parallel".  Otherwise you'd have to
> have the block accept exactly as many args as there are elements.  (Or
> of course accept a collection, in which case you're back to square
> one.)
>
> -Dave
>
> --
> LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
> Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
> See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
> Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment