元组参数

方法可以采用数组参数并将其立即解构为命名的局部变量。在 Mathias Meyer 的博客上找到。

def feed( amount, (animal, food) )

    p "#{amount} #{animal}s chew some #{food}"

end

feed 3, [ 'rabbit', 'grass' ] # => "3 rabbits chew some grass"