Mixing keyword with regular arguments in Ruby?

Viewed 9130

Ruby 2.0 supports keyword arguments. I was wondering, what are the 'rules' for mixing regular with keyword arguments? Something like this would not work:

def some_method(a: 'first', b: 'second', c)
  [a, b, c]
end

but this will:

def some_method(c, a: 'first', b: 'second')
  [a, b, c]
end

So why does putting a regular argument before the keyword arguments (and not after) works?

Is there some reference on the web on this (mixing keyword and regular arguments)? I can't seem to find any.

3 Answers
Related