Method: Struct#values_at
- Defined in:
- struct.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 </code>.select<code>.
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)
|
# File 'struct.c'
/*
* call-seq:
* struct.values_at(selector,... ) -> an_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 </code>.select<code>.
*
* 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)
*/
static VALUE
rb_struct_values_at(int argc, VALUE *argv, VALUE s)
{
return rb_get_values_at(s, RSTRUCT_LEN(s), argc, argv, struct_entry);
}
|