On Tue, Mar 10, 2009 at 3:39 PM, Torm3nt <[email protected]> wrote:
> We all know ruby can read very similarly to english at times, but also has
> some very curious idioms around. Wanted to see what everyone's favourite
> syntactical options were in ruby. I'll start:

Another idiom -- perhaps not worthy of the name, because I've only
recently been made aware of it.

Rather than this

  def initialize(a, b, c)
    @a, @b, @c = a, b, c
  end

You can do this

  def initialize(*args)
    @a, @b, @c = *args
  end

Definitely a matter of taste, but worth knowing about.  It's easy to
read in code, but it wouldn't be nice in RDoc output.

Gavin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to