values_at

struct.values_at(selector,... ) â an_array
Instance Public methods

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>.

1
2
3
4
5
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)
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.