rx 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/Gemfile +1 -1
  4. data/examples/aggregate.rb +3 -3
  5. data/examples/amb.rb +4 -4
  6. data/examples/ambproto.rb +3 -3
  7. data/examples/and.rb +4 -4
  8. data/examples/as_observable.rb +2 -2
  9. data/examples/average.rb +3 -3
  10. data/examples/buffer_with_count.rb +3 -3
  11. data/examples/buffer_with_time.rb +3 -3
  12. data/examples/case.rb +5 -5
  13. data/examples/catch.rb +4 -4
  14. data/examples/catchproto.rb +5 -5
  15. data/examples/combine_latest.rb +4 -4
  16. data/examples/combine_latestproto.rb +3 -3
  17. data/examples/concat.rb +4 -4
  18. data/examples/concat_all.rb +3 -3
  19. data/examples/concat_map.rb +4 -4
  20. data/examples/concat_map_observer.rb +5 -5
  21. data/examples/concatproto.rb +3 -3
  22. data/examples/connect.rb +3 -3
  23. data/examples/contains.rb +3 -3
  24. data/examples/count.rb +3 -3
  25. data/examples/create.rb +4 -4
  26. data/examples/debounce.rb +3 -3
  27. data/examples/default_if_empty.rb +3 -3
  28. data/examples/defer.rb +3 -3
  29. data/examples/delay.rb +3 -3
  30. data/examples/delay_with_selector.rb +6 -6
  31. data/examples/dematerialize.rb +4 -4
  32. data/examples/disposable.rb +3 -3
  33. data/examples/distinct.rb +3 -3
  34. data/examples/distinct_until_changed.rb +3 -3
  35. data/examples/do.rb +4 -4
  36. data/examples/empty.rb +2 -2
  37. data/examples/for.rb +3 -3
  38. data/examples/fork_join.rb +6 -6
  39. data/examples/from.rb +7 -7
  40. data/examples/from_array.rb +2 -2
  41. data/examples/from_callback.rb +2 -2
  42. data/examples/generate.rb +2 -2
  43. data/examples/group_join.rb +5 -5
  44. data/examples/if.rb +6 -6
  45. data/examples/intervals.rb +2 -2
  46. data/examples/merge.rb +4 -4
  47. data/examples/merge_all.rb +3 -3
  48. data/examples/multicast.rb +4 -4
  49. data/examples/never.rb +2 -2
  50. data/examples/of.rb +2 -2
  51. data/examples/on_error_resume_next.rb +5 -5
  52. data/examples/pairs.rb +2 -2
  53. data/examples/publish.rb +5 -5
  54. data/examples/range.rb +2 -2
  55. data/examples/reduce.rb +2 -2
  56. data/examples/repeat.rb +2 -2
  57. data/examples/return.rb +2 -2
  58. data/examples/scan.rb +3 -3
  59. data/examples/start.rb +3 -3
  60. data/examples/throw.rb +3 -3
  61. data/examples/time_intervals.rb +2 -2
  62. data/examples/timer.rb +2 -2
  63. data/examples/timestamp.rb +2 -2
  64. data/examples/to_a.rb +2 -2
  65. data/examples/to_async.rb +2 -2
  66. data/examples/using.rb +3 -3
  67. data/examples/when.rb +4 -4
  68. data/examples/while.rb +3 -3
  69. data/examples/window_with_time.rb +3 -3
  70. data/examples/zip.rb +3 -3
  71. data/examples/zip_array.rb +3 -3
  72. data/lib/core_ext/enumerable.rb +3 -3
  73. data/lib/{rx_ruby.rb → rx.rb} +11 -11
  74. data/lib/{rx_ruby → rx}/concurrency/async_lock.rb +1 -1
  75. data/lib/{rx_ruby → rx}/concurrency/current_thread_scheduler.rb +6 -6
  76. data/lib/{rx_ruby → rx}/concurrency/default_scheduler.rb +8 -8
  77. data/lib/{rx_ruby → rx}/concurrency/historical_scheduler.rb +3 -3
  78. data/lib/{rx_ruby → rx}/concurrency/immediate_scheduler.rb +4 -4
  79. data/lib/{rx_ruby → rx}/concurrency/local_scheduler.rb +3 -3
  80. data/lib/{rx_ruby → rx}/concurrency/periodic_scheduler.rb +1 -1
  81. data/lib/{rx_ruby → rx}/concurrency/scheduled_item.rb +2 -2
  82. data/lib/{rx_ruby → rx}/concurrency/scheduler.rb +1 -1
  83. data/lib/{rx_ruby → rx}/concurrency/virtual_time_scheduler.rb +4 -4
  84. data/lib/{rx_ruby → rx}/core/async_lock_observer.rb +4 -4
  85. data/lib/{rx_ruby → rx}/core/auto_detach_observer.rb +4 -4
  86. data/lib/{rx_ruby → rx}/core/checked_observer.rb +2 -2
  87. data/lib/{rx_ruby → rx}/core/notification.rb +3 -3
  88. data/lib/{rx_ruby → rx}/core/observable.rb +6 -6
  89. data/lib/{rx_ruby → rx}/core/observe_on_observer.rb +2 -2
  90. data/lib/{rx_ruby → rx}/core/observer.rb +1 -1
  91. data/lib/{rx_ruby → rx}/core/scheduled_observer.rb +3 -3
  92. data/lib/{rx_ruby → rx}/core/synchronized_observer.rb +3 -3
  93. data/lib/{rx_ruby → rx}/core/time_interval.rb +1 -1
  94. data/lib/{rx_ruby → rx}/internal/priority_queue.rb +1 -1
  95. data/lib/{rx_ruby → rx}/internal/util.rb +1 -1
  96. data/lib/{rx_ruby → rx}/joins/active_plan.rb +1 -1
  97. data/lib/{rx_ruby → rx}/joins/join_observer.rb +1 -1
  98. data/lib/{rx_ruby → rx}/joins/pattern.rb +1 -1
  99. data/lib/{rx_ruby → rx}/joins/plan.rb +1 -1
  100. data/lib/{rx_ruby → rx}/linq/connectable_observable.rb +1 -1
  101. data/lib/{rx_ruby → rx}/linq/observable/_observable_timer_date_and_period.rb +1 -1
  102. data/lib/{rx_ruby → rx}/linq/observable/_observable_timer_time_span.rb +1 -1
  103. data/lib/{rx_ruby → rx}/linq/observable/_observable_timer_time_span_and_period.rb +1 -1
  104. data/lib/{rx_ruby → rx}/linq/observable/aggregate.rb +2 -2
  105. data/lib/{rx_ruby → rx}/linq/observable/and.rb +1 -1
  106. data/lib/{rx_ruby → rx}/linq/observable/case.rb +1 -1
  107. data/lib/{rx_ruby → rx}/linq/observable/concat_all.rb +1 -1
  108. data/lib/{rx_ruby → rx}/linq/observable/concat_map.rb +1 -1
  109. data/lib/{rx_ruby → rx}/linq/observable/concat_map_observer.rb +1 -1
  110. data/lib/{rx_ruby → rx}/linq/observable/contains.rb +1 -1
  111. data/lib/{rx_ruby → rx}/linq/observable/debounce.rb +1 -1
  112. data/lib/{rx_ruby → rx}/linq/observable/delay.rb +1 -1
  113. data/lib/{rx_ruby → rx}/linq/observable/delay_with_selector.rb +1 -1
  114. data/lib/{rx_ruby → rx}/linq/observable/do.rb +1 -1
  115. data/lib/{rx_ruby → rx}/linq/observable/for.rb +1 -1
  116. data/lib/{rx_ruby → rx}/linq/observable/fork_join.rb +1 -1
  117. data/lib/{rx_ruby → rx}/linq/observable/from.rb +1 -1
  118. data/lib/{rx_ruby → rx}/linq/observable/group_join.rb +1 -1
  119. data/lib/{rx_ruby → rx}/linq/observable/if.rb +1 -1
  120. data/lib/rx/linq/observable/interval.rb +5 -0
  121. data/lib/{rx_ruby → rx}/linq/observable/multicast.rb +1 -1
  122. data/lib/{rx_ruby → rx}/linq/observable/of.rb +1 -1
  123. data/lib/{rx_ruby → rx}/linq/observable/pairs.rb +1 -1
  124. data/lib/{rx_ruby → rx}/linq/observable/pluck.rb +1 -1
  125. data/lib/{rx_ruby → rx}/linq/observable/publish.rb +1 -1
  126. data/lib/{rx_ruby → rx}/linq/observable/start.rb +1 -1
  127. data/lib/{rx_ruby → rx}/linq/observable/time_interval.rb +1 -1
  128. data/lib/{rx_ruby → rx}/linq/observable/timer.rb +1 -1
  129. data/lib/{rx_ruby → rx}/linq/observable/timestamp.rb +1 -1
  130. data/lib/{rx_ruby → rx}/linq/observable/to_async.rb +1 -1
  131. data/lib/{rx_ruby → rx}/linq/observable/when.rb +1 -1
  132. data/lib/{rx_ruby → rx}/linq/observable/while.rb +1 -1
  133. data/lib/{rx_ruby → rx}/operators/aggregates.rb +31 -31
  134. data/lib/{rx_ruby → rx}/operators/creation.rb +6 -6
  135. data/lib/{rx_ruby → rx}/operators/multiple.rb +22 -23
  136. data/lib/{rx_ruby → rx}/operators/single.rb +14 -14
  137. data/lib/{rx_ruby → rx}/operators/standard_query_operators.rb +6 -6
  138. data/lib/{rx_ruby → rx}/operators/synchronization.rb +8 -8
  139. data/lib/{rx_ruby → rx}/operators/time.rb +12 -12
  140. data/lib/{rx_ruby → rx}/subjects/async_subject.rb +4 -4
  141. data/lib/{rx_ruby → rx}/subjects/behavior_subject.rb +3 -3
  142. data/lib/{rx_ruby → rx}/subjects/replay_subject.rb +5 -5
  143. data/lib/{rx_ruby → rx}/subjects/subject.rb +4 -4
  144. data/lib/{rx_ruby → rx}/subjects/subject_extensions.rb +3 -3
  145. data/lib/{rx_ruby → rx}/subscriptions/composite_subscription.rb +1 -1
  146. data/lib/{rx_ruby → rx}/subscriptions/ref_count_subscription.rb +2 -2
  147. data/lib/{rx_ruby → rx}/subscriptions/scheduled_subscription.rb +1 -1
  148. data/lib/{rx_ruby → rx}/subscriptions/serial_subscription.rb +1 -1
  149. data/lib/{rx_ruby → rx}/subscriptions/single_assignment_subscription.rb +1 -1
  150. data/lib/{rx_ruby → rx}/subscriptions/subscription.rb +1 -1
  151. data/lib/{rx_ruby → rx}/testing/cold_observable.rb +4 -4
  152. data/lib/{rx_ruby → rx}/testing/hot_observable.rb +4 -4
  153. data/lib/{rx_ruby → rx}/testing/mock_observer.rb +4 -4
  154. data/lib/{rx_ruby → rx}/testing/reactive_test.rb +3 -3
  155. data/lib/{rx_ruby → rx}/testing/recorded.rb +1 -1
  156. data/lib/{rx_ruby → rx}/testing/test_scheduler.rb +8 -8
  157. data/lib/{rx_ruby → rx}/testing/test_subscription.rb +1 -1
  158. data/lib/rx/version.rb +3 -0
  159. data/readme.md +19 -19
  160. data/{rx_ruby.gemspec → rx.gemspec} +2 -2
  161. data/test/{rx_ruby → rx}/concurrency/helpers/historical_virtual_scheduler_helper.rb +0 -0
  162. data/test/{rx_ruby → rx}/concurrency/helpers/immediate_local_scheduler_helper.rb +0 -0
  163. data/test/{rx_ruby → rx}/concurrency/test_async_lock.rb +1 -1
  164. data/test/{rx_ruby → rx}/concurrency/test_current_thread_scheduler.rb +3 -3
  165. data/test/{rx_ruby → rx}/concurrency/test_default_scheduler.rb +1 -1
  166. data/test/{rx_ruby → rx}/concurrency/test_historical_scheduler.rb +3 -3
  167. data/test/{rx_ruby → rx}/concurrency/test_immediate_scheduler.rb +2 -2
  168. data/test/{rx_ruby → rx}/concurrency/test_local_scheduler.rb +2 -2
  169. data/test/{rx_ruby → rx}/concurrency/test_periodic_scheduler.rb +1 -1
  170. data/test/{rx_ruby → rx}/concurrency/test_scheduled_item.rb +4 -4
  171. data/test/{rx_ruby → rx}/concurrency/test_scheduler.rb +2 -2
  172. data/test/{rx_ruby → rx}/concurrency/test_virtual_time_scheduler.rb +2 -2
  173. data/test/{rx_ruby → rx}/core/test_notification.rb +20 -20
  174. data/test/{rx_ruby → rx}/core/test_observable_creation.rb +220 -63
  175. data/test/{rx_ruby → rx}/core/test_observer.rb +39 -39
  176. data/test/{rx_ruby → rx}/internal/test_priority_queue.rb +6 -6
  177. data/test/{rx_ruby → rx}/subscriptions/test_composite_subscription.rb +20 -20
  178. data/test/{rx_ruby → rx}/subscriptions/test_serial_subscription.rb +9 -9
  179. data/test/{rx_ruby → rx}/subscriptions/test_singleassignment_subscription.rb +8 -8
  180. data/test/{rx_ruby → rx}/subscriptions/test_subscription.rb +3 -3
  181. data/test/test_helper.rb +1 -1
  182. metadata +129 -129
  183. data/lib/rx_ruby/linq/observable/interval.rb +0 -5
  184. data/lib/rx_ruby/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ffb05bbb6d701c73a57492647ab8c4adeb99e18
4
- data.tar.gz: d7807b50b9855b5d72ce182d1f8844b2f4baba76
3
+ metadata.gz: f95c760d911eea140a0b60493775fe7867897a2c
4
+ data.tar.gz: 11f892c743e5c5527fb2b074a3ffb184a486b6f8
5
5
  SHA512:
6
- metadata.gz: dbc3bec8a204ef3a880cbf3d677b6f4534f51c14910d5ad94fbcc17cc5d0ad778355659ab4ba9b0747f8df125621f28aa9eca6bdf7bf54af2a5e750ad3c1c4aa
7
- data.tar.gz: 24cd708c83eb97935c6478c6e7581697e267af41150f3cbeee1ef3a5d434825787942e3aefeff6538c6032192e8686f696ad93973f390be2897c69711896d13c
6
+ metadata.gz: dcbc5062f069e6ffcb10f137112dfe085e5c121c1dd2845fff5bd2e84c16c23880b41b5a71c8df650db7f339b4ae6a1e4f8df0b89a035c61c2d61f575dd72c86
7
+ data.tar.gz: 076ab5a3cc1942fd5fbd83ab05a98587aca261eab81b5dc3a9cd5c889aa899dcb1ad3e8e735655700b036ef448224a65e2f86764548d6ba7e69a7d192f370583
@@ -1,9 +1,12 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  rvm:
3
5
  - 1.9.3
4
6
  - 2.0.0
5
7
  - 2.1.2
6
8
  - 2.2.0
9
+ - 2.3.0
7
10
  - jruby-19mode # JRuby in 1.9 mode
8
11
  - rbx-2.6
9
12
  before_install:
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in rx_ruby.gemspec
3
+ # Specify your gem's dependencies in rx.gemspec
4
4
  gemspec
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using a seed for the accumulate
4
- source = RxRuby::Observable.range(1, 10).aggregate(1) {|acc, x|
4
+ source = Rx::Observable.range(1, 10).aggregate(1) {|acc, x|
5
5
  acc * x
6
6
  }
7
7
 
@@ -20,7 +20,7 @@ subscription = source.subscribe(
20
20
  # => Completed
21
21
 
22
22
  # Without a seed
23
- source = RxRuby::Observable.range(1, 10).aggregate {|acc, x|
23
+ source = Rx::Observable.range(1, 10).aggregate {|acc, x|
24
24
  acc + x
25
25
  }
26
26
 
@@ -1,9 +1,9 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using Observable sequences
4
- source = RxRuby::Observable.amb(
5
- RxRuby::Observable.timer(0.5).map { 'foo' },
6
- RxRuby::Observable.timer(0.2).map { 'bar' }
4
+ source = Rx::Observable.amb(
5
+ Rx::Observable.timer(0.5).map { 'foo' },
6
+ Rx::Observable.timer(0.2).map { 'bar' }
7
7
  )
8
8
 
9
9
  subscription = source.subscribe(
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- first = RxRuby::Observable.timer(0.3).map { 'first' }
4
- second = RxRuby::Observable.timer(0.5).map { 'second' }
3
+ first = Rx::Observable.timer(0.3).map { 'first' }
4
+ second = Rx::Observable.timer(0.5).map { 'second' }
5
5
 
6
6
  source = first.amb(second)
7
7
 
@@ -1,9 +1,9 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Choice of either plan, the first set of timers or second set
4
- source = RxRuby::Observable.when(
5
- RxRuby::Observable.timer(0.2).and(RxRuby::Observable.timer(0.3)).then_do(lambda {|x, y| return 'first' }),
6
- RxRuby::Observable.timer(0.4).and(RxRuby::Observable.timer(0.5)).then_do(lambda {|x, y| return 'second' }),
4
+ source = Rx::Observable.when(
5
+ Rx::Observable.timer(0.2).and(Rx::Observable.timer(0.3)).then_do(lambda {|x, y| return 'first' }),
6
+ Rx::Observable.timer(0.4).and(Rx::Observable.timer(0.5)).then_do(lambda {|x, y| return 'second' }),
7
7
  )
8
8
 
9
9
  subscription = source.subscribe(
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Create subject
4
- subject = RxRuby::AsyncSubject.new
4
+ subject = Rx::AsyncSubject.new
5
5
 
6
6
  # Send a value
7
7
  subject.on_next(42)
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without a selector
4
- source = RxRuby::Observable.range(0, 9).average
4
+ source = Rx::Observable.range(0, 9).average
5
5
 
6
6
  subscription = source.subscribe(
7
7
  lambda {|x|
@@ -24,7 +24,7 @@ arr = [
24
24
  { value: 3 }
25
25
  ]
26
26
 
27
- source = RxRuby::Observable.from_array(arr).average {|x|
27
+ source = Rx::Observable.from_array(arr).average {|x|
28
28
  x[:value]
29
29
  }
30
30
 
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without a skip
4
- source = RxRuby::Observable.range(1, 6)
4
+ source = Rx::Observable.range(1, 6)
5
5
  .buffer_with_count(2)
6
6
 
7
7
  subscription = source.subscribe(
@@ -21,7 +21,7 @@ subscription = source.subscribe(
21
21
  # => Completed
22
22
 
23
23
  # Using a skip
24
- source = RxRuby::Observable.range(1, 6)
24
+ source = Rx::Observable.range(1, 6)
25
25
  .buffer_with_count(2, 1)
26
26
 
27
27
  subscription = source.subscribe(
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without a skip
4
- source = RxRuby::Observable.interval(0.1)
4
+ source = Rx::Observable.interval(0.1)
5
5
  .buffer_with_time(0.5)
6
6
  .take(3)
7
7
 
@@ -26,7 +26,7 @@ while Thread.list.size > 1
26
26
  end
27
27
 
28
28
  # Using a skip
29
- source = RxRuby::Observable.interval(0.1)
29
+ source = Rx::Observable.interval(0.1)
30
30
  .buffer_with_time(0.5, 0.1)
31
31
  .take(3)
32
32
 
@@ -1,13 +1,13 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  sources = {
4
- 'foo' => RxRuby::Observable.return(42),
5
- 'bar' => RxRuby::Observable.return(56)
4
+ 'foo' => Rx::Observable.return(42),
5
+ 'bar' => Rx::Observable.return(56)
6
6
  }
7
7
 
8
- defaultSource = RxRuby::Observable.empty()
8
+ defaultSource = Rx::Observable.empty()
9
9
 
10
- source = RxRuby::Observable.case(
10
+ source = Rx::Observable.case(
11
11
  lambda {
12
12
  'foo'
13
13
  },
@@ -1,9 +1,9 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- obs1 = RxRuby::Observable.raise_error(Exception.new('error'))
4
- obs2 = RxRuby::Observable.return(42)
3
+ obs1 = Rx::Observable.raise_error(Exception.new('error'))
4
+ obs2 = Rx::Observable.return(42)
5
5
 
6
- source = RxRuby::Observable.rescue_error(obs1, obs2)
6
+ source = Rx::Observable.rescue_error(obs1, obs2)
7
7
 
8
8
  subscription = source.subscribe(
9
9
  lambda {|x|
@@ -1,8 +1,8 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using a second observable
4
- source = RxRuby::Observable.raise_error(Exception.new)
5
- .rescue_error(RxRuby::Observable.return(42))
4
+ source = Rx::Observable.raise_error(Exception.new)
5
+ .rescue_error(Rx::Observable.return(42))
6
6
 
7
7
  subscription = source.subscribe(
8
8
  lambda {|x|
@@ -19,9 +19,9 @@ subscription = source.subscribe(
19
19
  # => Completed
20
20
 
21
21
  # Using a handler function
22
- source = RxRuby::Observable.raise_error(Exception.new)
22
+ source = Rx::Observable.raise_error(Exception.new)
23
23
  .rescue_error {|e|
24
- RxRuby::Observable.return(e.is_a? Exception)
24
+ Rx::Observable.return(e.is_a? Exception)
25
25
  }
26
26
 
27
27
  subscription = source.subscribe(
@@ -1,14 +1,14 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Have staggering intervals
4
- source1 = RxRuby::Observable.interval(0.1)
4
+ source1 = Rx::Observable.interval(0.1)
5
5
  .map {|i| 'First: ' + i.to_s }
6
6
 
7
- source2 = RxRuby::Observable.interval(0.15)
7
+ source2 = Rx::Observable.interval(0.15)
8
8
  .map {|i| 'Second: ' + i.to_s }
9
9
 
10
10
  # Combine latest of source1 and source2 whenever either gives a value
11
- source = RxRuby::Observable.combine_latest(
11
+ source = Rx::Observable.combine_latest(
12
12
  source1,
13
13
  source2) {|s1, s2| s1.to_s + ', ' + s2.to_s }
14
14
  .take(4)
@@ -1,10 +1,10 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Have staggering intervals
4
- source1 = RxRuby::Observable.interval(0.1)
4
+ source1 = Rx::Observable.interval(0.1)
5
5
  .map {|i| 'First: ' + i.to_s }
6
6
 
7
- source2 = RxRuby::Observable.interval(0.15)
7
+ source2 = Rx::Observable.interval(0.15)
8
8
  .map {|i| 'Second: ' + i.to_s }
9
9
 
10
10
  # Combine latest of source1 and source2 whenever either gives a value
@@ -1,10 +1,10 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using Observable sequences
4
- source1 = RxRuby::Observable.return(42)
5
- source2 = RxRuby::Observable.return(56)
4
+ source1 = Rx::Observable.return(42)
5
+ source2 = Rx::Observable.return(56)
6
6
 
7
- source = RxRuby::Observable.concat(source1, source2)
7
+ source = Rx::Observable.concat(source1, source2)
8
8
 
9
9
  subscription = source.subscribe(
10
10
  lambda {|x|
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable.range(0, 3)
4
- .map {|x| RxRuby::Observable.range(x, 3) }
3
+ source = Rx::Observable.range(0, 3)
4
+ .map {|x| Rx::Observable.range(x, 3) }
5
5
  .concat_all
6
6
 
7
7
  subscription = source.subscribe(
@@ -1,8 +1,8 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable.range(0, 5)
3
+ source = Rx::Observable.range(0, 5)
4
4
  .concat_map(lambda {|x, i|
5
- return RxRuby::Observable
5
+ return Rx::Observable
6
6
  .interval(0.1)
7
7
  .take(x).map { i }
8
8
  })
@@ -35,7 +35,7 @@ while Thread.list.size > 1
35
35
  end
36
36
 
37
37
  # Using an array
38
- source = RxRuby::Observable.of(1,2,3)
38
+ source = Rx::Observable.of(1,2,3)
39
39
  .concat_map(
40
40
  lambda {|x, i| return [x,i] },
41
41
  lambda {|x, y, ix, iy| return x + y + ix + iy }
@@ -1,15 +1,15 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable.range(1, 3)
3
+ source = Rx::Observable.range(1, 3)
4
4
  .concat_map_observer(
5
5
  lambda {|x, i|
6
- return RxRuby::Observable.repeat(x, i)
6
+ return Rx::Observable.repeat(x, i)
7
7
  },
8
8
  lambda {|err|
9
- return RxRuby::Observable.return(42)
9
+ return Rx::Observable.return(42)
10
10
  },
11
11
  lambda {
12
- return RxRuby::Observable.empty
12
+ return Rx::Observable.empty
13
13
  })
14
14
 
15
15
  subscription = source.subscribe(
@@ -1,8 +1,8 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable
3
+ source = Rx::Observable
4
4
  .return(42)
5
- .concat(RxRuby::Observable.return(56), RxRuby::Observable.return(72))
5
+ .concat(Rx::Observable.return(56), Rx::Observable.return(72))
6
6
 
7
7
  subscription = source.subscribe(
8
8
  lambda {|x|
@@ -1,13 +1,13 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- interval = RxRuby::Observable.interval(1)
3
+ interval = Rx::Observable.interval(1)
4
4
 
5
5
  source = interval
6
6
  .take(2)
7
7
  .do {|x| puts 'Side effect' }
8
8
 
9
9
  def create_observer(tag)
10
- return RxRuby::Observer.create(
10
+ return Rx::Observer.create(
11
11
  lambda {|x|
12
12
  puts 'Next: ' + tag + x.to_s
13
13
  },
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without an index
4
- source = RxRuby::Observable.of(42)
4
+ source = Rx::Observable.of(42)
5
5
  .contains(42)
6
6
 
7
7
  subscription = source.subscribe(
@@ -19,7 +19,7 @@ subscription = source.subscribe(
19
19
  # => Completed
20
20
 
21
21
  # With an index
22
- source = RxRuby::Observable.of(1,2,3)
22
+ source = Rx::Observable.of(1,2,3)
23
23
  .contains(2, 1)
24
24
 
25
25
  subscription = source.subscribe(
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without a predicate
4
- source = RxRuby::Observable.range(0, 10).count
4
+ source = Rx::Observable.range(0, 10).count
5
5
 
6
6
  subscription = source.subscribe(
7
7
  lambda {|x|
@@ -18,7 +18,7 @@ subscription = source.subscribe(
18
18
  # => Completed
19
19
 
20
20
  # With a predicate
21
- source = RxRuby::Observable.range(0, 10)
21
+ source = Rx::Observable.range(0, 10)
22
22
  .count {|x| x % 2 === 0 }
23
23
 
24
24
  subscription = source.subscribe(
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using a function
4
- source = RxRuby::Observable.create {|observer|
4
+ source = Rx::Observable.create {|observer|
5
5
  observer.on_next(42)
6
6
  observer.on_completed
7
7
 
@@ -30,12 +30,12 @@ subscription.dispose
30
30
  # => disposed
31
31
 
32
32
  # Using a disposable
33
- source = RxRuby::Observable.create {|observer|
33
+ source = Rx::Observable.create {|observer|
34
34
  observer.on_next(42)
35
35
  observer.on_completed
36
36
 
37
37
  # Note that this is optional, you do not have to return this if you require no cleanup
38
- RxRuby::Disposable.create {
38
+ Rx::Disposable.create {
39
39
  puts 'disposed'
40
40
  }
41
41
  }
@@ -1,4 +1,4 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  times = [
4
4
  { value: 0, time: 0.1 },
@@ -9,9 +9,9 @@ times = [
9
9
  ]
10
10
 
11
11
  # Delay each item by time and project value
12
- source = RxRuby::Observable.from(times)
12
+ source = Rx::Observable.from(times)
13
13
  .flat_map {|item|
14
- RxRuby::Observable.of(item[:value])
14
+ Rx::Observable.of(item[:value])
15
15
  .delay(item[:time])
16
16
  }
17
17
  .debounce 0.5 # ms
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without a default value
4
- source = RxRuby::Observable.empty.default_if_empty
4
+ source = Rx::Observable.empty.default_if_empty
5
5
 
6
6
  subscription = source.subscribe(
7
7
  lambda {|x|
@@ -18,7 +18,7 @@ subscription = source.subscribe(
18
18
  # => Completed
19
19
 
20
20
  # With a default_value
21
- source = RxRuby::Observable.empty.default_if_empty(false)
21
+ source = Rx::Observable.empty.default_if_empty(false)
22
22
 
23
23
  subscription = source.subscribe(
24
24
  lambda {|x|