Skip to content

Is merge function behavior correct? #73

@tyfkda

Description

@tyfkda

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions