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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…