On Thu, Nov 13, 2008 at 02:06:15AM +0900, Charles Oliver Nutter wrote:
> def foo(a, b = 1, *c, d)
> => [[:req, :a], [:opt, :b, 1], [:rest, :c], [:req, :d]]

As an object, I would represent this as:

  #<Parameters params=[
    #<Parameter required=true, name=:a>,
    #<Parameter required=false, default="1", name=:b>,
    #<Parameter required=false, rest=true, name=:c>,
    #<Parameter required=true, rest=true, name=:d>
  ]>

> def foo(a, (b, c))
> => [[:req, :a], [[:req, :a], [:req, :b]]]

And this as:

  #<Parameters params=[
    #<Parameter required=true, name=:a>,
    #<Parameters params=[
      #<Parameter required=true name=:a>,
      #<Parameter required=true name=:b>
    ]
  ]>

Paul