aboutsummaryrefslogtreecommitdiffstats
path: root/range.c
Commit message (Collapse)AuthorAgeFilesLines
* Adding links to literals and Kernel (#5192)Burdette Lamar2021-12-031-8/+10
| | | | * Adding links to literals and Kernel
* Some codes replace to `RBOOL` macro (#5023)S.H2021-11-091-4/+2
| | | | | | | * Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function
* [DOC] Fix code markup [ci skip]Nobuyoshi Nakada2021-10-251-2/+2
| | | | Code markup in RDoc must not be concatenated with anothr word.
* Unify iteration argumentsNobuyoshi Nakada2021-10-101-14/+2
|
* Update iteration step in step_i_iterNobuyoshi Nakada2021-10-101-10/+6
|
* Refactor sym_step_i functionS.H2021-10-101-9/+11
|
* Using NIL_P macro instead of `== Qnil`S.H2021-10-031-2/+2
|
* Remove unnecessary checks in `Range#each` [Bug #18237]Jörg W Mittag2021-10-031-1/+0
| | | | | | | | | | | | | | | 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.
* Correct two errors in Range RDoc (#4889)Burdette Lamar2021-09-231-2/+2
|
* What's Here for Range (#4881)Burdette Lamar2021-09-221-4/+88
|
* Enhanced RDoc for Range (#4870)Burdette Lamar2021-09-201-88/+151
| | | Introductory material revised.
* Enhanced RDoc for Range (#4847)Burdette Lamar2021-09-181-66/+190
| | | | | | | | | | | Treated: #to_s #inspect #=== #include? #cover? #count
* Enhanced RDoc for Range#minmax (#4846)Burdette Lamar2021-09-151-6/+40
|
* Enhanced RDoc for Range#max (#4844)Burdette Lamar2021-09-151-34/+78
|
* Enhanced RDoc for Range#min (#4842)Burdette Lamar2021-09-151-10/+73
|
* [DOC] Fix broken links [ci skip]Nobuyoshi Nakada2021-09-151-1/+1
| | | | | | * 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.
* Enhanced RDoc for Range (#4839)Burdette Lamar2021-09-141-46/+81
| | | | | | | | | | | | Treated: #size #to_a #each #begin #end #first #last
* Bsearch doc for Array and Range (#4838)Burdette Lamar2021-09-141-44/+2
| | | This PR creates doc/bsearch.rdoc to provide common documentation for bsearch in Array and Range.
* Enhanced RDoc for Range (#4833)Burdette Lamar2021-09-131-55/+94
| | | | | | | | | | | Treated: ::new #include_end? #== #eql? #hash #step
* Using RB_FLOAT_TYPE_P macroS-H-GAMELINKS2021-09-121-1/+1
|
* Using RBOOL macroS.H2021-08-021-8/+3
|
* Refactor sym_each_i functionS-H-GAMELINKS2021-07-221-2/+1
|
* Use public allocators for creating new T_OBJECT objectsAaron Patterson2020-10-281-4/+1
| | | | This way the header flags and object internals are set correctly
* numeric.c, range.c: prohibit zero stepKenta Murata2020-10-231-0/+7
| | | | | | | | | * numeric.c: prohibit zero step in Numeric#step * range.c: prohibit zero step in Range#step * Fix ruby-spec [Feature #15573]
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-6/+3
|
* Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)Kenta Murata2020-10-211-18/+51
| | | | | | | | | | | | | | | | | * 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]
* range.c: Fix an exception message in rb_range_beg_lenKenta Murata2020-10-201-5/+2
| | | | [Bug #17271]
* freeze all Range objects.v3_0_0_preview1Koichi Sasada2020-09-251-0/+4
| | | | | Matz want to try to freeze all Range objects. [Feature #15504]
* Removed trailing spaces [ci skip]Nobuyoshi Nakada2020-09-021-1/+1
|
* Update documentation for Range#maxJeremy Evans2020-09-011-8/+28
|
* Revert "Fix Range#{max,minmax} for range with integer beginning and ↵Jeremy Evans2020-09-011-18/+3
| | | | | | non-integer end" This reverts commit 8900a25581822759daca528d46a75e0b743fc22e.
* Revert "Special case Range#max for integer beginning and Float::Infinity end"Jeremy Evans2020-09-011-9/+0
| | | | This reverts commit 05bf811c2839628aaef3d565daedb28be80d47ef.
* Special case Range#max for integer beginning and Float::Infinity endJeremy Evans2020-07-191-0/+9
| | | | | | | | | 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]
* Fix Range#max for beginless Integer ranges [Bug #17034]Michael Kohl2020-07-191-3/+4
| | | | | | | | | * 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>
* Fix Range#{max,minmax} for range with integer beginning and non-integer endJeremy Evans2020-07-131-3/+18
| | | | | | | | | | | | | 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]
* Use static variables in Range#minmaxJeremy Evans2020-07-041-2/+4
|
* Fix non-numeric exclusive Range#minmax bugSam Bostock2020-07-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* add UNREACHABLE_RETURN卜部昌平2020-06-291-0/+2
| | | | | | 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.
* range_each: do not goto into a branch卜部昌平2020-06-291-20/+36
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Suppress -Wswitch warningsNobuyoshi Nakada2020-04-081-0/+2
|
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-3/+3
| | | Split ruby.h
* more on NULL versus functions.卜部昌平2020-02-071-1/+1
| | | | | | Function pointers are not void*. See also ce4ea956d24eab5089a143bba38126f2b11b55b6 8427fca49bd85205f5a8766292dd893f003c0e48
* decouple internal.h headers卜部昌平2019-12-261-3/+13
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* range.c: Range#min with a beginless one now raise an explicit exceptionYusuke Endoh2019-12-251-0/+7
| | | | [Bug #16450]
* Enhance Range docszverok2019-12-221-10/+24
| | | | | | | | * Change === docs to mention it uses cover? * Add different example to === docs to showcase behavior better * Change include? docs to mention cover? and clarify the difference
* Fixed misspellingsNobuyoshi Nakada2019-12-201-2/+2
| | | | Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
* implement Range#count卜部昌平2019-12-041-0/+37
| | | | As matz requested in [Bug #16366].
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-2/+0
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.