-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
Provide at least:
- jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b OpenJDK 64-Bit Server VM 25.222-b10 on 1.8.0_222-b10 +jit [darwin-x86_64]
- Darwin Jakobs-MacBook-Pro-2.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
Other relevant info you may wish to add:
- just in irb, no gems loaded
Expected Behavior
In mri ruby I can use slice_after on a lazy enumerator to slice up a stream of elements into a grouped enumerator:
irb(main):001:0> %w(a x b x c).lazy.slice_after(/x/).to_a
=> [["a", "x"], ["b", "x"], ["c"]]
Actual Behavior
irb(main):005:0> %w(a x b x c).lazy.slice_after(/x/).to_a
Traceback (most recent call last):
10: from /opt/rubies/jruby-9.2.6.0/bin/irb:13:in `<main>'
9: from org/jruby/RubyKernel.java:1179:in `catch'
8: from org/jruby/RubyKernel.java:1179:in `catch'
7: from org/jruby/RubyKernel.java:1411:in `loop'
6: from org/jruby/RubyKernel.java:1047:in `eval'
5: from (irb):5:in `evaluate'
4: from org/jruby/RubyEnumerable.java:461:in `to_a'
3: from org/jruby/RubyEnumerator.java:326:in `each'
2: from uri:classloader:/jruby/kernel/enumerator.rb:64:in `slice_after'
1: from uri:classloader:/jruby/kernel/enumerable.rb:37:in `slice_after'
ArgumentError (cannot pass both filter argument and block)
Interestingly this only seems to affect lazy enumerators. With a non-lazy enumerator it works as expected:
irb(main):002:0> %w(a x b x c).slice_after(/x/).to_a
=> [["a", "x"], ["b", "x"], ["c"]]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels