Method: Array#values_at
- Defined in:
- array.c
#values_at(selector, ...) ⇒ Array
Returns an array containing the elements in self corresponding to the given selector(s). The selectors may be either integer indices or ranges. See also Array#select.
a = %w{ a b c d e f }
a.values_at(1, 3, 5)
a.values_at(1, 3, 5, 7)
a.values_at(-1, -3, -5, -7)
a.values_at(1..3, 2...5)
1793 1794 1795 |
# File 'array.c', line 1793 static VALUE rb_ary_values_at(argc, argv, ary) int argc; |