ReactiveX/Rx.rb

View on GitHub
examples/concat_all.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'rx'

source = Rx::Observable.range(0, 3)
  .map {|x| Rx::Observable.range(x, 3) }
  .concat_all

subscription = source.subscribe(
  lambda {|x|
    puts 'Next: ' + x.to_s
  },
  lambda {|err|
    puts 'Error: ' + err.to_s
  },
  lambda {
    puts 'Completed'
  })

# => Next: 0
# => Next: 1
# => Next: 2
# => Next: 1
# => Next: 2
# => Next: 3
# => Next: 2
# => Next: 3
# => Next: 4
# => Completed