summaryrefslogtreecommitdiff
path: root/array.c
AgeCommit message (Collapse)Author
39 hoursUsing RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
6 daysshould not share same `def` for specialized methodKoichi Sasada
Because the key of redefine table is `def`, `def` should be unique for each optimized method (`alias` is not allowed). Notes: Merged: https://github.com/ruby/ruby/pull/4493
2021-06-21What's Here for Numeric and ComparableBurdette Lamar
2021-06-17Adjust styles [ci skip]Nobuyoshi Nakada
* --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
2021-05-21Do not allow array modifications after freeze inside sort!Jeremy Evans
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] Notes: Merged: https://github.com/ruby/ruby/pull/4335 Merged-By: jeremyevans <code@jeremyevans.net>
2021-05-08Fix example code in Array#max docMasataka Pocke Kuwabara
`[0, 1, 2, 3].max(6)` actually returns `[3, 2, 1, 0]`, but the doc said it returns `[3, 2, 1]`. Notes: Merged: https://github.com/ruby/ruby/pull/4475
2021-05-04Correctly update array capacity after reallocPeter Zhu
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. Notes: Merged: https://github.com/ruby/ruby/pull/4448
2021-04-21array.c (rb_ary_zip): take only as many as needed from an Enumerator (#4389)Yusuke Endoh
[Bug #17814] Notes: Merged-By: mame <mame@ruby-lang.org>
2021-04-16Add Array#intersect?Travis Hunter
Notes: Merged: https://github.com/ruby/ruby/pull/1972
2021-03-29[DOC] Improve an example of Array#count comparison [ci skip]Nobuyoshi Nakada
2021-03-28[Doc] Fix Array#count comparing strategyKenichi Kamiya
Notes: Merged: https://github.com/ruby/ruby/pull/4332
2021-03-20Ensure the receiver is modifiable before shrinking [Bug #17736]Nobuyoshi Nakada
* Ensure the receiver is modifiable before shinking [Bug #17736] * Assert the receivers are not modified Notes: Merged: https://github.com/ruby/ruby/pull/4296 Merged-By: nobu <nobu@ruby-lang.org>
2021-02-12Define rb_to_array which converts with to_aNobuyoshi Nakada
2021-02-07[DOC] {Array,MatchData}#values_at understand ranges [ci skip]Nobuyoshi Nakada
2021-02-06Improve performance of Array#- when it is called with empty arrayMasaki Matsushita
This change make Array#- return a copy of the receiver when the other array is empty.
2021-02-06[DOC] Fixed a markup in Array#sum [ci skip]Nobuyoshi Nakada
2021-01-20Explicit references to EnumerableBurdetteLamar
2021-01-18Revert "[Document][Array] Add missing call-seq for Array#append"Marc-Andre Lafortune
This reverts commit ac1a4bccbda4358436a7a907a7f09d047f562740. See https://github.com/ruby/ruby/pull/4088
2021-01-18[Document][Array] Add missing call-seq for Array#appendJuanito Fatas
Notes: Merged: https://github.com/ruby/ruby/pull/4088
2021-01-15Add What's Here to Array RDoc (#4062)Burdette Lamar
* Add What's Here to Array RDoc Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-12-21Document usage of ArithmeticSequence in Array#slice, and add to NEWS (#3952)Victor Shepelev
Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-12-18Use category: :deprecated in warnings that are related to deprecationJeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/3917
2020-12-07tuning trial: newobj with current ecKoichi Sasada
Passing current ec can improve performance of newobj. This patch tries it for Array and String literals ([] and ''). Notes: Merged: https://github.com/ruby/ruby/pull/3842
2020-12-01should not use rb_ary_modify()Koichi Sasada
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 Notes: Merged: https://github.com/ruby/ruby/pull/3831
2020-11-10Removed canonicalization for mathnNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3691
2020-11-10Fix linksS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/3738
2020-11-03Make Array methods return Array instances instead of subclass instancesJeremy Evans
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] Notes: Merged: https://github.com/ruby/ruby/pull/3690 Merged-By: jeremyevans <code@jeremyevans.net>
2020-10-21Don't redefine #rb_intern over and over againStefan Stüben
Notes: Merged: https://github.com/ruby/ruby/pull/3589
2020-10-21Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)Kenta Murata
* 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] Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-09-02Comply with guide for method doc: array.c (#3506)Burdette Lamar
Methods: any? all? one? none? sum shuffle! shuffle sample Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-01Comply with guide for method doc: array.c (#3499)Burdette Lamar
Methods considered: count flatten! flatten cycle permutation combination repeated_permutation repeated_combination product take take_while drop drop_while Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-31Comply with guide for method doc: array.c (#3489)Burdette Lamar
Methods considered: & intersection | union max min minmax uniq! uniq compact! compact Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-31Comply with guide for method doc: array.c (#3484)Burdette Lamar
Methods: + concat * assoc rassoc == eql? hash include? <=> - difference Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-31Comply with guide for method doc: array.c (#3477)Burdette Lamar
Methods considered: delete_at slice! reject! reject delete_if zip transpose replace clear fill Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-30Comply with guide for method doc: array.c (#3475)Burdette Lamar
Methods considered: bsearch bsearch_index sort_by! collect collect! values_at select select! keep_if delete Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-29Comply with guide for method doc: array.c (#3474)Burdette Lamar
Methods considered: length empty? join inspect to_a to_h to_ary reverse! reverse rotate! rotate sort! sort Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-29Comply with guide for method doc: array.c (#3473)Burdette Lamar
Methods considered: at first last fetch index rindex [] insert each each_index reverse_each Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-28Comply with guide for method doc: array.c (#3469)Burdette Lamar
Methods: - freeze - try_convert - new - \<< - push - pop - shift - unshift - [] Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-23Remove checks for self returned in array.c and hash.c examples (#3446)Burdette Lamar
Further compliance with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc#details-and-examples- Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-21Remove trivial examples from array.c (#3442)Burdette Lamar
"Trivial" typically means "returns a new empty Array." Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-20Remove nil-return examples from array.c (#3437)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-19Partial compliance with doc/method_documentation.rdoc (#3431)Burdette Lamar
Removes references to *-convertible thingies. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-15RARRAY_AREF: convert into an inline function卜部昌平
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. Notes: Merged: https://github.com/ruby/ruby/pull/3419
2020-08-14Fix links to Dig Methods document (#3421)Burdette Lamar
* Fix links to Dig Methods document * Fix links to Dig Methods document Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-13Adding doc/dig_methods.rdoc and links to it (#3416)Burdette Lamar
Adds a full discussion of #dig, along with links from Array, Hash, Struct, and OpenStruct. CSV::Table and CSV::Row are over in ruby/csv. I'll get to them soon. The art to the thing is to figure out how much (or how little) to say at each #dig. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-13MAYBE_UNUSED should just suffice卜部昌平
This reverts commit c355fa72d4e356378a8b03a67432b52bafcc308b. Notes: Merged: https://github.com/ruby/ruby/pull/3411
2020-08-10Enhanced RDoc for Array (#3400)Burdette Lamar
Methods: drop drop_while any? all? none? one? Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-10Removed non-ASCII code to suppress warnings by localized compilersNobuyoshi Nakada
2020-08-10Suppress unused-function warningsNobuyoshi Nakada
Calls with a constant argument should be optimized away.
2020-08-07Enhanced RDoc for Array#take and Array#take_while (#3398)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>