Yukihiro "Matz" Matsumoto
49ae2a69f2
Add mrb_get_arg1() that retrieves single (and only) argument.
...
`mrb_get_arg1()` raises `ArgumentError` if the method does not receive one
argument.
And replaces all `mrb_get_args(mrb, "o", &arg)` by the new function.
2020-06-20 12:49:46 +09:00
Yukihiro "Matz" Matsumoto
76f1aa7de5
Remove mrb_funcall from <=> operations.
2019-09-14 09:05:32 +09:00
KOBAYASHI Shuji
6cfcff6f10
Fix Range#max test (TypeError is raised) on 32-bit mode with word boxing
2019-09-05 19:51:32 +09:00
KOBAYASHI Shuji
13f58f9bc2
Fix Range#max test (TypeError is raised) on 32-bit mode
2019-08-24 14:22:10 +09:00
Yukihiro "Matz" Matsumoto
cdf5e3963d
Merge branch 'master' into fix-range-min-with-mruby-range-ext
2019-07-17 22:33:55 +09:00
KOBAYASHI Shuji
1b7516a4ae
Fix (fixnum_value ... float_value).min with mruby-range-ext
...
Before this patch:
$ bin/mruby -e 'p (2...4.0).min' #=> TypeError
After this patch (same as CRuby and without `mruby-range-ext`):
$ bin/mruby -e 'p (2...4.0).min' #=> 2
2019-07-17 19:18:23 +09:00
KOBAYASHI Shuji
8cb37804c1
Allow mruby-range-ext to work with MRB_WITHOUT_FLOAT; ref 2add8641
2019-07-17 18:58:21 +09:00
Yukihiro "Matz" Matsumoto
2add864164
Allow mruby-range-ext to work with MRB_WITHOUT_FLOAT; ref #4576
2019-07-17 10:36:10 +09:00
dearblue
c96b517ea2
Error needed/conflicts configuration
...
The purpose is to clarify the error if there is a needed/conflicts
configuration at compile time.
2019-07-14 00:29:17 +09:00
Ryan Lopopolo
56929362f5
Fix Range#min fast path with exclusive range
2019-07-09 01:48:15 -07:00
Ryan Lopopolo
0ad5ba7a0f
Add a fast path for Float and Fixnum ranges for Range#max and Range#min
...
If no block is given and the Range has Fixnum or Float endpoints, do not iterate with
each and instead compare the endpoints directly. This implementation passes all of
the applicable specs from Ruby Spec.
2019-07-09 01:42:40 -07:00
Ryan Lopopolo
eab07daf92
Add Range#max and Range#min tests from Ruby Spec
2019-07-09 01:41:10 -07:00
Yukihiro "Matz" Matsumoto
1c574b065d
Remove mrb_ prefix from static functions in mruby-range-ext; #4213
2019-01-04 14:46:17 +09:00
KOBAYASHI Shuji
648b57620a
range: Embed edges in RRange on boxing environment.
...
[Breaking changes]
Developers must use following APIs for accessing attributes of RRange
because RRange structure depends on boxing setting.
- mrb_range_beg
- mrb_range_end
- mrb_range_excl_p
2019-01-01 15:35:56 +09:00
Yukihiro "Matz" Matsumoto
afca99a40b
Remove implicit conversion using to_int method.
...
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120 .
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto
1d781da8a6
Should not include float.h here.
2017-08-11 13:52:01 +09:00
Yukihiro "Matz" Matsumoto
bc1259de3b
add explicit casts
2017-01-02 17:48:44 +09:00
Yukihiro "Matz" Matsumoto
79a621dd73
Check before retrieving struct RRange pointer; fix #3320
...
range->edges may be NULL for example when #initialize_copy removed.
2016-12-03 12:30:01 +09:00
Tomasz Dąbrowski
72ed7eebc3
Fixed Range.size to use proper floating point tolerance
2016-11-24 12:50:49 +01:00
Yukihiro "Matz" Matsumoto
a70104798e
remove unnecessary ".!"; ref #3261
2016-11-22 16:55:18 +09:00
ksss
682237be6e
Reimplements Range#first
...
Range#first shouldn't call `Range#to_a` on infinity range.
2016-11-21 16:55:49 +09:00
ksss
22390aa1c8
Use mrb_float instead of double
2016-11-19 23:25:08 +09:00
ksss
a2fbd80a47
Fix Range#size results
2016-11-19 23:25:07 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Jun Hiroe
4e4929bc72
Rename extended xxxx class or module to xxxx class or module extension
2015-06-28 11:18:52 +09:00
Jun Hiroe
c69d1201e1
Fix typo; Replace extensional with extended
2015-06-28 00:05:58 +09:00
Yukihiro "Matz" Matsumoto
91a025b1e6
reimplement Range#size using double with fixing corner cases; ref #2293
2014-05-19 18:04:27 +09:00
Jun Hiroe
4b3ff090ab
Add Range#size
2014-05-19 16:17:10 +09:00
Yukihiro "Matz" Matsumoto
7c82b9e1bf
use mrb_get_args("i")
2014-03-21 23:36:03 +09:00
take_cheeze
c73f8d4def
move summary of mrbgems in default gembox to its spec
2014-03-17 00:34:24 +09:00
cremno
09bb30870b
tiny word boxing optimization
2014-01-02 06:36:29 +01:00
Daniel Bovensiepen
d10763190e
Improve test of mruby-range-ext GEM
2013-08-04 22:42:06 +08:00
Tomoyuki Sahara
116f75a8ce
"spec.author" is better for single-author gems.
...
"spec.author=" expects a String represents a single author.
"spec.authors=" expects an Array which is a list of multiple authors.
http://guides.rubygems.org/specification-reference/
2013-07-23 10:09:24 +09:00
Jun Hiroe
8e42868600
Repalace int with mrb_bool because a return value is boolean.
2013-07-15 23:17:12 +09:00
Yukihiro "Matz" Matsumoto
30d580ecbc
rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206
2013-04-25 09:47:36 +09:00
h2so5
1d10912076
Add mruby-range-ext
2013-04-14 13:59:46 +09:00