元組引數

方法可以採用陣列引數並將其立即解構為命名的區域性變數。在 Mathias Meyer 的部落格上找到。

def feed( amount, (animal, food) )

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

end

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