summaryrefslogtreecommitdiff
path: root/range.c
AgeCommit message (Collapse)Author
2022-04-25Document beginless, endless ranges in Range class documentationJeremy Evans
2022-03-30Repaired What's Here sections for Range, String, Symbol, Struct (#5735)Burdette Lamar
Repaired What's Here sections for Range, String, Symbol, Struct. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-02-12[DOC] Simplify operator method referencesNobuyoshi Nakada
2022-02-09Fix Range#include? for beginless exclusive string rangesJeremy Evans
Previously, include? would return true for the end of the range, when it should return false because the range is exclusive. Research and Analysis by Victor Shepelev. Fixes [Bug #18577] Notes: Merged: https://github.com/ruby/ruby/pull/5541
2022-02-08[DOC] Fix broken links to operator methodsNobuyoshi Nakada
Once https://github.com/ruby/rdoc/pull/865 is merged, these hacks are no longer needed.
2022-02-08[DOC] Fix broken links to literals.rdocNobuyoshi Nakada
2022-02-07[DOC] Use RDoc link style for links in the same class/modulePeter Zhu
I used this regex: (?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-02-07[DOC] Use RDoc link style for links to other classes/modulesPeter Zhu
I used this regex: ([A-Za-z]+)\.html#(?:class|module)-[A-Za-z]+-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2021-12-03Adding links to literals and Kernel (#5192)Burdette Lamar
* Adding links to literals and Kernel Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-09Some codes replace to `RBOOL` macro (#5023)S.H
* Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function Notes: Merged-By: nobu <nobu@ruby-lang.org>
2021-10-25[DOC] Fix code markup [ci skip]Nobuyoshi Nakada
Code markup in RDoc must not be concatenated with anothr word.
2021-10-10Unify iteration argumentsNobuyoshi Nakada
2021-10-10Update iteration step in step_i_iterNobuyoshi Nakada
2021-10-10Refactor sym_step_i functionS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4923 Merged-By: nobu <nobu@ruby-lang.org>
2021-10-03Using NIL_P macro instead of `== Qnil`S.H
Notes: Merged: https://github.com/ruby/ruby/pull/4925 Merged-By: nobu <nobu@ruby-lang.org>
2021-10-03Remove unnecessary checks in `Range#each` [Bug #18237]Jörg W Mittag
In commit:7817a438eb1803e7b3358f43bd1f38479badfbdc, the implementation of `Time#succ`, which had been deprecated for 10 years, was finally removed. During that time, there was an explicit `instance_of?` check in source:range.c#L350 with a comment that the check should be removed once `Time#succ` is removed. Since `Time#succ` is now gone, this check should be removed. Note: this should be coordinated with adding a version guard to the corresponding check in ruby/spec as well. Notes: Merged: https://github.com/ruby/ruby/pull/4928 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-23Correct two errors in Range RDoc (#4889)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-22What's Here for Range (#4881)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-20Enhanced RDoc for Range (#4870)Burdette Lamar
Introductory material revised. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-18Enhanced RDoc for Range (#4847)Burdette Lamar
Treated: #to_s #inspect #=== #include? #cover? #count Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-15Enhanced RDoc for Range#minmax (#4846)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-15Enhanced RDoc for Range#max (#4844)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-15Enhanced RDoc for Range#min (#4842)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-15[DOC] Fix broken links [ci skip]Nobuyoshi Nakada
* As the "doc/" prefix is specified by the `--page-dir` option, remove from the rdoc references. * Refer to the original .rdoc instead of the converted .html.
2021-09-14Enhanced RDoc for Range (#4839)Burdette Lamar
Treated: #size #to_a #each #begin #end #first #last Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-14Bsearch doc for Array and Range (#4838)Burdette Lamar
This PR creates doc/bsearch.rdoc to provide common documentation for bsearch in Array and Range. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-13Enhanced RDoc for Range (#4833)Burdette Lamar
Treated: ::new #include_end? #== #eql? #hash #step Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-12Using RB_FLOAT_TYPE_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4821
2021-08-02Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-22Refactor sym_each_i functionS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4644
2020-10-28Use public allocators for creating new T_OBJECT objectsAaron Patterson
This way the header flags and object internals are set correctly Notes: Merged: https://github.com/ruby/ruby/pull/3719
2020-10-23numeric.c, range.c: prohibit zero stepKenta Murata
* numeric.c: prohibit zero step in Numeric#step * range.c: prohibit zero step in Range#step * Fix ruby-spec [Feature #15573] Notes: Merged: https://github.com/ruby/ruby/pull/3689 Merged-By: mrkn <mrkn@ruby-lang.org>
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-10-20range.c: Fix an exception message in rb_range_beg_lenKenta Murata
[Bug #17271]
2020-09-25freeze all Range objects.v3_0_0_preview1Koichi Sasada
Matz want to try to freeze all Range objects. [Feature #15504] Notes: Merged: https://github.com/ruby/ruby/pull/3583
2020-09-02Removed trailing spaces [ci skip]Nobuyoshi Nakada
2020-09-01Update documentation for Range#maxJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/3500
2020-09-01Revert "Fix Range#{max,minmax} for range with integer beginning and ↵Jeremy Evans
non-integer end" This reverts commit 8900a25581822759daca528d46a75e0b743fc22e. Notes: Merged: https://github.com/ruby/ruby/pull/3500
2020-09-01Revert "Special case Range#max for integer beginning and Float::Infinity end"Jeremy Evans
This reverts commit 05bf811c2839628aaef3d565daedb28be80d47ef. Notes: Merged: https://github.com/ruby/ruby/pull/3500
2020-07-19Special case Range#max for integer beginning and Float::Infinity endJeremy Evans
Popular Ruby libraries such as Rails and Rubocop relying on the previous behavior, even though it is technically a bug. The correct behavior is probably raising RangeError, since that is what an endless range raises. Related to [Bug #17017]
2020-07-19Fix Range#max for beginless Integer ranges [Bug #17034]Michael Kohl
* Fix Range#max for beginless Integer ranges * Update test/ruby/test_range.rb * Fix formatting https://github.com/ruby/ruby/pull/3328 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: nobu <nobu@ruby-lang.org>
2020-07-13Fix Range#{max,minmax} for range with integer beginning and non-integer endJeremy Evans
Previously, for inclusive ranges, the max would show up as the end of the range, even though the end was not an integer and would not be the maximum value. For exclusive ranges, max/minmax would previously raise a TypeError, even though it is possible to get the correct maximum. This change to max/minmax also uncovered a similar error in cover?, which calls max in certain cases, so adjust the code there so that cover? still works as expected. Fixes [Bug #17017] Notes: Merged: https://github.com/ruby/ruby/pull/3306 Merged-By: jeremyevans <code@jeremyevans.net>
2020-07-04Use static variables in Range#minmaxJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/3286
2020-07-04Fix non-numeric exclusive Range#minmax bugSam Bostock
The implementation of Range#minmax added in d5c60214c45 causes the following incorrect behaviour: ('a'...'c').minmax => ["a", ["a", "b"]] instead of ('a'...'c').minmax => ["a", "b"] This is because the C implementation of Range#minmax (range_minmax) directly delegates to the C implementation of Range#min (range_min) and Range#max (range_max), without changing the execution context. Range#max's C implementation (range_max), when given a non-numeric exclusive range, delegates to super, which is meant to call Enumerable#max. However, because range_max is called directly by range_minmax, super calls Enumerable#minmax instead, causing the incorrect nesting. Perhaps it is possible to change the execution context in an optimized manner, but the simplest solution seems to be to just explicitly delegate from Range#minmax to Range#min and Range#max. Notes: Merged: https://github.com/ruby/ruby/pull/3285
2020-06-29add UNREACHABLE_RETURN卜部昌平
Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29range_each: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-08Suppress -Wswitch warningsNobuyoshi Nakada