Method: Weak::Map#values_at
- Defined in:
- lib/weak/map.rb
#values_at(*keys) ⇒ Array
Returns a new Array containing values for the given keys:
map = Weak::Map[foo: 0, bar: 1, baz: 2]
map.values_at(:baz, :foo)
# => [2, 0]
The default values are returned for any keys that are not found:
map.values_at(:hello, :foo)
# => [nil, 0]
810 811 812 |
# File 'lib/weak/map.rb', line 810 def values_at(*keys) keys.map { |key| self[key] } end |