summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--array.c4
-rw-r--r--re.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/array.c b/array.c
index ad7e11afb7..07b3df0861 100644
--- a/array.c
+++ b/array.c
@@ -3728,15 +3728,17 @@ append_values_at_single(VALUE result, VALUE ary, long olen, VALUE idx)
* array.values_at(*indexes) -> new_array
*
* Returns a new \Array whose elements are the elements
- * of +self+ at the given \Integer +indexes+.
+ * of +self+ at the given \Integer or \Range +indexes+.
*
* For each positive +index+, returns the element at offset +index+:
* a = [:foo, 'bar', 2]
* a.values_at(0, 2) # => [:foo, 2]
+ * a.values_at(0..1) # => [:foo, "bar"]
*
* The given +indexes+ may be in any order, and may repeat:
* a = [:foo, 'bar', 2]
* a.values_at(2, 0, 1, 0, 2) # => [2, :foo, "bar", :foo, 2]
+ * a.values_at(1, 0..2) # => ["bar", :foo, "bar", 2]
*
* Assigns +nil+ for an +index+ that is too large:
* a = [:foo, 'bar', 2]
diff --git a/re.c b/re.c
index 9964e292fd..4be5e8beb0 100644
--- a/re.c
+++ b/re.c
@@ -2077,6 +2077,7 @@ match_aref(int argc, VALUE *argv, VALUE match)
* m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
* m.to_a #=> ["HX1138", "H", "X", "113", "8"]
* m.values_at(0, 2, -2) #=> ["HX1138", "X", "113"]
+ * m.values_at(1..2, -1) #=> ["H", "X", "8"]
*
* m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
* m.to_a #=> ["1 + 2", "1", "+", "2"]