1 Matching Annotations
  1. Oct 2022
    1. But what if we’ve more elements to ignore? people = { "Alice" => ["green", 34, "alice@example.com"], "Bob" => ["brown", 27, "bob@example.com"] } No problem. Just re-use the underscore: people.map { |name, (_, _, email)| [name, email] } You can’t do it with any variable, though, at least in Ruby 1.9. It only works with variables that are called _: people.map { |name, (x, x, email)| [name, email] } # SyntaxError: (eval):2: duplicated argument name