mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
029169bc5b
commit
fd8991f797
Notes:
git
2021-05-28 06:18:06 +09:00
2 changed files with 10 additions and 1 deletions
|
@ -2700,8 +2700,13 @@ lazy_with_index_proc(VALUE proc_entry, struct MEMO* result, VALUE memos, long me
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
lazy_with_index_size(VALUE proc, VALUE receiver) {
|
||||||
|
return receiver;
|
||||||
|
}
|
||||||
|
|
||||||
static const lazyenum_funcs lazy_with_index_funcs = {
|
static const lazyenum_funcs lazy_with_index_funcs = {
|
||||||
lazy_with_index_proc, 0,
|
lazy_with_index_proc, lazy_with_index_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -682,4 +682,8 @@ EOS
|
||||||
ary = (0..Float::INFINITY).lazy.with_index.take(2).to_a
|
ary = (0..Float::INFINITY).lazy.with_index.take(2).to_a
|
||||||
assert_equal([[0, 0], [1, 1]], ary)
|
assert_equal([[0, 0], [1, 1]], ary)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_with_index_size
|
||||||
|
assert_equal(3, Enumerator::Lazy.new([1, 2, 3], 3){|y, v| y << v}.with_index.size)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue