Yukihiro "Matz" Matsumoto
2f9b1fdb0c
Merge pull request #4255 from shuujii/enumerator-size-is-not-supported
...
`Enumerator#size` is not supported [ci skip]
2019-09-16 15:37:58 +09:00
Yukihiro "Matz" Matsumoto
2fa4a55e80
Replace loop method with while true loop to gain performance.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
ad4bdda074
Update assert_take for zero size take.
2019-09-13 02:28:56 +09:00
Yukihiro "Matz" Matsumoto
f5542b9927
Add Enumerator.produce from Ruby2.7
2019-09-13 02:28:56 +09:00
KOBAYASHI Shuji
a70107d725
Drop dependency from mruby-enumerator to mruby-enum-ext
2019-07-28 13:08:11 +09:00
KOBAYASHI Shuji
cdb458ed4e
Commented out String#scan because it is not implemented yet
2019-04-21 20:34:39 +09:00
KOBAYASHI Shuji
19740d45a1
Add NoMethodError tests to mruby-enumerator
2019-02-08 17:40:12 +09:00
Yukihiro "Matz" Matsumoto
e0bc87297e
Update mruby-enumerator test to conform the last update.
2019-02-08 09:35:28 +09:00
Yukihiro "Matz" Matsumoto
9ab7c1111b
Update #4265 patch.
...
* Update doc comment to clarify `Enumerator.new` without a block is
deprecated and left only for internal use.
* Fixed some cases `mruby` raise `ArgumentError` too eagerly compared
with `CRuby`.
2019-02-08 09:35:28 +09:00
KOBAYASHI Shuji
2650999092
Fix Enumerator#(initialize|inspect) for nil/false
2019-02-08 09:35:28 +09:00
KOBAYASHI Shuji
465fdde52d
Enumerator#size is not supported [ci skip]
2019-01-31 21:25:35 +09:00
KOBAYASHI Shuji
6218585968
Remove unneeded dup in Enumerator#initialize
2019-01-30 19:41:32 +09:00
KOBAYASHI Shuji
bc03650c6a
mruby-enumerator: Refine accessors (obj/meth/args/fib).
...
- `fib=` writer is not used.
- All accessors are used as public (e.g. in `initialized_copy`).
2018-12-30 11:30:14 +09:00
Yukihiro "Matz" Matsumoto
698f5f707c
Removed to_ary conversion method.
2018-11-19 12:08:28 +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
0a0cc5a217
Check method existence for Enumerators; fix #3920
...
The issue #3920 was fixed but the fundamental flaw of lack of stack
depth check along with fibers still remains, even though it's not
easy to cause the issue. Use `MRB_GC_FIXED_ARENA` to avoid the issue
for workaround.
After this patch, `obj.to_enum` raises `ArgumentError` if the object
does not respond to the enumerating method. This is incompatible to
CRuby but I think this behavior is better and CRuby should be updated
to behave like this.
2018-11-19 10:57:07 +09:00
ksss
3a22d113ee
Reimplement Enumerable#zip with Enumerator
...
for fix some specs
- [passes each element of the result array to a block and return nil if a block is given](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L11-L17 )
- [converts arguments to arrays using #to_ary](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L23-L27 )
- [converts arguments to enums using #to_enum](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L29-L34 )
- [gathers whole arrays as elements when each yields multiple](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L36-L39 )
2018-03-27 10:53:33 +09:00
Yukihiro "Matz" Matsumoto
b4f9b031de
Some cosmetic changes
2017-11-22 16:09:50 +09:00
Yukihiro "Matz" Matsumoto
6c966a1f86
Change the order of "expected" and "actual" in test
2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto
68470bef86
Check method existence in `to_enum'; ref #3773
2017-08-11 09:21:09 +09:00
Christopher Aue
3359b86ec7
Improved speed of enumeration methods
2017-07-30 13:19:31 +02:00
Yukihiro "Matz" Matsumoto
464d3fc0a3
Use alias enum_for to_enum instead of alias :enum_for :to_enum.
2017-06-21 11:13:43 +09:00
Kenji Okimoto
d93a5c1a84
Fix Enumerator#each_with_index with block
...
In previous version,
```
a = [3, 2, 1]
e = a.each
e.sort_by(&:to_i) # => []
```
In this version,
```
a = [3, 2, 1]
e = a.each
e.sort_by(&:to_i) # => [1, 2, 3]
```
2017-03-30 10:53:55 +09:00
ksss
2718fed124
Support svalue
2016-12-01 16:13:24 +09:00
ksss
0f774ff4df
Support nil argument as no argument
2016-12-01 15:33:27 +09:00
ksss
31f0ffeac8
Support Enumerable methods
2016-12-01 10:42:57 +09:00
Yukihiro "Matz" Matsumoto
727f2485c9
Merge pull request #2999 from sagmor/better-docs
...
More Docs
2015-10-22 07:10:16 +09:00
Seba Gamboa
25c8e95365
Revert "Mark core gems with mrbgem tag"
...
This reverts commit 5cdcce8dbd .
2015-10-21 14:31:13 -03:00
Yukihiro "Matz" Matsumoto
7278fd1f1b
loop may return StopIteration#result; [ruby-bugs#11498]
2015-10-21 21:47:25 +09:00
Seba Gamboa
13b552538a
Remove obvious warnings from docs
2015-10-20 12:48:31 -03:00
Seba Gamboa
45e70e4dd6
Fix enumerator doc errors
2015-10-20 12:16:47 -03:00
Seba Gamboa
5cdcce8dbd
Mark core gems with mrbgem tag
2015-10-20 12:16:47 -03:00
Yukihiro "Matz" Matsumoto
569c7dec5f
move StopIteration to core; close #2518
2014-08-08 16:08:53 +09:00
take_cheeze
4a6c651f82
Run mrbgem and core tests on minimum dependencies.
...
Solves #2355 .
In test drivers:
* Uses `mrb_t_pass_result` to check and pass test result to main `mrb_state`.
* Adds `mrb_init_test_driver` to init test `mrb_state`.
2014-07-12 20:36:45 +09:00
Yukihiro "Matz" Matsumoto
5867167ffd
add dependency information based on #2239 ; fix #2236 , close #2239
2014-05-13 13:08:18 +09:00
Yukihiro "Matz" Matsumoto
f454f827ee
should not use String#<< which is defined in mruby-string-ext; use Array#join instead; ref #2239
2014-05-13 12:59:21 +09:00
Nobuyoshi Nakada
ab67c57f65
remove trailing spaces
2014-04-30 09:50:14 +09:00
Yukihiro "Matz" Matsumoto
8808c9a31a
wrap args by parens
2014-04-06 20:29:54 +09:00
Jun Hiroe
1368ae647b
Add args in Enumerator#inspect
2014-04-06 02:45:04 +09:00
Yukihiro "Matz" Matsumoto
2277c374db
revert #1974 ; ref #1979
2014-03-30 08:29:09 +09:00
ksss
5a2014b8f8
Enumerator#initialize support duck-type
2014-03-29 09:24:00 +09:00
Jun Hiroe
110486debe
Fix a typo
2014-03-29 00:16:12 +09:00
Yukihiro "Matz" Matsumoto
b5cb8284ba
Enumerable#zip to use enumerator if mruby-enumerator gem is available
2014-03-27 14:35:07 +09:00
Yukihiro "Matz" Matsumoto
8250016136
use __svalue instead of ary2sv
2014-03-27 14:28:49 +09:00
ksss
d9068f0583
Hash#{reject,reject!} fix yield value
2014-03-23 20:13:49 +09:00
ksss
d09e4475bf
Hash#{select,select!} fix yield value
2014-03-23 13:31:26 +09:00
ksss
5386cd9b9b
Hash#each_{key,value} support return Enumerator
...
if non block given
2014-03-23 00:22:22 +09:00
Yukihiro "Matz" Matsumoto
2bf718faf8
Merge pull request #1882 from ksss/enum-find_all
...
Enumerable#find_all return Enumerator if non block given
2014-03-19 10:43:54 +09:00
ksss
fd80d4ecdd
Enumerable#find_all return Enumerator if non block given
2014-03-17 23:32:31 +09:00
ksss
9abe413530
Enumrable#each_with_index return Enumerator if non block given
2014-03-17 22:31:40 +09:00