summaryrefslogtreecommitdiff
path: root/array.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Bsearch doc for Array and Range (#4838)Burdette Lamar2021-09-141-82/+1
| | | This PR creates doc/bsearch.rdoc to provide common documentation for bsearch in Array and Range.
* Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS2021-09-111-2/+2
|
* include/ruby/internal/intern/array.h: add doxygen卜部昌平2021-09-101-8/+0
| | | | Must not be a bad idea to improve documents. [ci skip]
* Guard array when appendingAaron Patterson2021-09-021-0/+1
| | | | | | | This prevents early collection of the array. The GC doesn't see the array on the stack when Ruby is compiled with optimizations enabled [ruby-core:105099] [Bug #18140]
* Fix a code in the Array#min documentation.universato2021-08-311-2/+1
|
* Fix length calculation for Array#slice!Mike Dalessio2021-08-291-1/+1
| | | | | | | | | Commit 4f24255 introduced a bug which allows a length to be passed to rb_ary_new4 which is too large, resulting in invalid memory access. For example: (1..1000).to_a.slice!(-2, 1000)
* Using RBOOL macroS.H2021-08-021-3/+1
|
* should not share same `def` for specialized methodKoichi Sasada2021-07-291-1/+1
| | | | | Because the key of redefine table is `def`, `def` should be unique for each optimized method (`alias` is not allowed).
* What's Here for Numeric and ComparableBurdette Lamar2021-06-211-2/+5
|
* Adjust styles [ci skip]Nobuyoshi Nakada2021-06-171-2/+4
| | | | | | | | | * --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
* Do not allow array modifications after freeze inside sort!Jeremy Evans2021-05-211-2/+13
| | | | | | | | | If freezing an array inside sort!, previously the array could be modified after the freeze. This checks whether the receiver is frozen after every yield and potential call to #> or #<, preventing modifications if the receiver is frozen inside the block or by the #> or #< call. Fixes [Bug #17739]
* Fix example code in Array#max docMasataka Pocke Kuwabara2021-05-081-1/+1
| | | | | `[0, 1, 2, 3].max(6)` actually returns `[3, 2, 1, 0]`, but the doc said it returns `[3, 2, 1]`.
* Correctly update array capacity after reallocPeter Zhu2021-05-041-5/+10
| | | | | | | | | Reallocating to a smaller size in the transient heap may result in no change in the actual capacity but the capacity of the array is still updated to the smaller value. This commit changes `ary_heap_realloc` to return the new capacity which can be used by the caller to correctly update the capacity.
* array.c (rb_ary_zip): take only as many as needed from an Enumerator (#4389)Yusuke Endoh2021-04-211-2/+2
| | | [Bug #17814]
* Add Array#intersect?Travis Hunter2021-04-161-0/+56
|
* [DOC] Improve an example of Array#count comparison [ci skip]Nobuyoshi Nakada2021-03-291-1/+1
|
* [Doc] Fix Array#count comparing strategyKenichi Kamiya2021-03-281-2/+2
|
* Ensure the receiver is modifiable before shrinking [Bug #17736]Nobuyoshi Nakada2021-03-201-0/+1
| | | | | * Ensure the receiver is modifiable before shinking [Bug #17736] * Assert the receivers are not modified
* Define rb_to_array which converts with to_aNobuyoshi Nakada2021-02-121-0/+6
|
* [DOC] {Array,MatchData}#values_at understand ranges [ci skip]Nobuyoshi Nakada2021-02-071-1/+3
|
* Improve performance of Array#- when it is called with empty arrayMasaki Matsushita2021-02-061-0/+1
| | | | | This change make Array#- return a copy of the receiver when the other array is empty.
* [DOC] Fixed a markup in Array#sum [ci skip]Nobuyoshi Nakada2021-02-061-1/+1
|
* Explicit references to EnumerableBurdetteLamar2021-01-201-1/+4
|
* Revert "[Document][Array] Add missing call-seq for Array#append"Marc-Andre Lafortune2021-01-181-1/+0
| | | | | | This reverts commit ac1a4bccbda4358436a7a907a7f09d047f562740. See https://github.com/ruby/ruby/pull/4088
* [Document][Array] Add missing call-seq for Array#appendJuanito Fatas2021-01-181-0/+1
|
* Add What's Here to Array RDoc (#4062)Burdette Lamar2021-01-151-0/+174
| | | | * Add What's Here to Array RDoc
* Document usage of ArithmeticSequence in Array#slice, and add to NEWS (#3952)Victor Shepelev2020-12-211-5/+16
|
* Use category: :deprecated in warnings that are related to deprecationJeremy Evans2020-12-181-1/+1
| | | | | | | | | | | | | | | | | Also document that both :deprecated and :experimental are supported :category option values. The locations where warnings were marked as deprecation warnings was previously reviewed by shyouhei. Comment a couple locations where deprecation warnings should probably be used but are not currently used because deprecation warning enablement has not occurred at the time they are called (RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K). Add assert_deprecated_warn to test assertions. Use this to simplify some tests, and fix failing tests after marking some warnings with deprecated category.
* tuning trial: newobj with current ecKoichi Sasada2020-12-071-0/+52
| | | | | Passing current ec can improve performance of newobj. This patch tries it for Array and String literals ([] and '').
* should not use rb_ary_modify()Koichi Sasada2020-12-011-11/+17
| | | | | | | | | | | ractor_copy() used rb_ary_modify() to make sure this array is not sharing anything, but it also checks frozen flag. So frozen arrays raises an error. To solve this issue, this patch introduces new function rb_ary_cancel_sharing() which makes sure the array does not share another array and it doesn't check frozen flag. [Bug #17343] A test is quoted from https://github.com/ruby/ruby/pull/3817
* Removed canonicalization for mathnNobuyoshi Nakada2020-11-101-7/+1
|
* Fix linksS-H-GAMELINKS2020-11-101-1/+1
|
* Make Array methods return Array instances instead of subclass instancesJeremy Evans2020-11-031-7/+5
| | | | | | | | | | | | | | | | This changes the following methods to return Array instances instead of subclass instances: * Array#drop * Array#drop_while * Array#flatten * Array#slice! * Array#slice/#[] * Array#take * Array#take_while * Array#uniq * Array#* Fixes [Bug #6087]
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-3/+0
|
* Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)Kenta Murata2020-10-211-8/+83
| | | | | | | | | | | | | | | | | * Support ArithmeticSequence in Array#slice * Extract rb_range_component_beg_len * Use rb_range_values to check Range object * Fix ary_make_partial_step * Fix for negative step cases * range.c: Describe the role of err argument in rb_range_component_beg_len * Raise a RangeError when an arithmetic sequence refers the outside of an array [Feature #16812]
* Comply with guide for method doc: array.c (#3506)Burdette Lamar2020-09-021-103/+47
| | | | | | | | | | | | | Methods: any? all? one? none? sum shuffle! shuffle sample
* Comply with guide for method doc: array.c (#3499)Burdette Lamar2020-09-011-95/+12
| | | | | | | | | | | | | | | | | | | Methods considered: count flatten! flatten cycle permutation combination repeated_permutation repeated_combination product take take_while drop drop_while
* Comply with guide for method doc: array.c (#3489)Burdette Lamar2020-08-311-63/+11
| | | | | | | | | | | | | | | | Methods considered: & intersection | union max min minmax uniq! uniq compact! compact
* Comply with guide for method doc: array.c (#3484)Burdette Lamar2020-08-311-74/+19
| | | | | | | | | | | | | | | | | Methods: + concat * assoc rassoc == eql? hash include? <=> - difference
* Comply with guide for method doc: array.c (#3477)Burdette Lamar2020-08-311-90/+14
| | | | | | | | | | | | | | | Methods considered: delete_at slice! reject! reject delete_if zip transpose replace clear fill
* Comply with guide for method doc: array.c (#3475)Burdette Lamar2020-08-301-54/+17
| | | | | | | | | | | | | | | | Methods considered: bsearch bsearch_index sort_by! collect collect! values_at select select! keep_if delete
* Comply with guide for method doc: array.c (#3474)Burdette Lamar2020-08-291-82/+13
| | | | | | | | | | | | | | | | | | | Methods considered: length empty? join inspect to_a to_h to_ary reverse! reverse rotate! rotate sort! sort
* Comply with guide for method doc: array.c (#3473)Burdette Lamar2020-08-291-143/+29
| | | | | | | | | | | | | | | | Methods considered: at first last fetch index rindex [] insert each each_index reverse_each
* Comply with guide for method doc: array.c (#3469)Burdette Lamar2020-08-281-122/+33
| | | | | | | | | | | | | Methods: - freeze - try_convert - new - \<< - push - pop - shift - unshift - []
* Remove checks for self returned in array.c and hash.c examples (#3446)Burdette Lamar2020-08-231-100/+33
| | | Further compliance with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc#details-and-examples-
* Remove trivial examples from array.c (#3442)Burdette Lamar2020-08-211-72/+12
| | | "Trivial" typically means "returns a new empty Array."
* Remove nil-return examples from array.c (#3437)Burdette Lamar2020-08-201-80/+24
|
* Partial compliance with doc/method_documentation.rdoc (#3431)Burdette Lamar2020-08-191-400/+54
| | | Removes references to *-convertible thingies.
* RARRAY_AREF: convert into an inline function卜部昌平2020-08-151-1/+1
| | | | | | RARRAY_AREF has been a macro for reasons. We might not be able to change that for public APIs, but why not relax the situation internally to make it an inline function.
* Fix links to Dig Methods document (#3421)Burdette Lamar2020-08-141-1/+1
| | | | | * Fix links to Dig Methods document * Fix links to Dig Methods document