Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is merge function behavior correct? #73

Open
tyfkda opened this issue Sep 26, 2015 · 0 comments
Open

Is merge function behavior correct? #73

tyfkda opened this issue Sep 26, 2015 · 0 comments

Comments

@tyfkda
Copy link

tyfkda commented Sep 26, 2015

I am playing with RxRuby, but I'm not sure that behavior of merge function is as expected.

Here is test code:

require './lib/rx'

count_stream = RX::Observable.range(1, 5)
fizz_stream = count_stream.select {|x| x % 3 == 0}.map {'Fizz'}
otherwise_stream = count_stream.select {|x| x % 3 != 0}

merged_stream = RX::Observable.merge(fizz_stream, otherwise_stream)
merged_stream.subscribe {|x| puts x}

I think merge function of Rx keeps event order (RxMarbles ), so I expect the code outputs 1 2 Fizz 4 5, but the result is:

1
Fizz
2
4
5

Is this behavior expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant