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
@@ -1,8 +1,8 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using an observable sequence
4
- source = RxRuby::Observable.defer {
5
- RxRuby::Observable.return(42)
4
+ source = Rx::Observable.defer {
5
+ Rx::Observable.return(42)
6
6
  }
7
7
 
8
8
  subscription = source.subscribe(
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using an absolute time to delay by a second
4
- source = RxRuby::Observable.range(0, 3)
4
+ source = Rx::Observable.range(0, 3)
5
5
  .delay(Time.now + 1)
6
6
 
7
7
  subscription = source.subscribe(
@@ -25,7 +25,7 @@ while Thread.list.size > 1
25
25
  end
26
26
 
27
27
  # Using an relatove time to delay by a second
28
- source = RxRuby::Observable.range(0, 3)
28
+ source = Rx::Observable.range(0, 3)
29
29
  .delay(1)
30
30
 
31
31
  subscription = source.subscribe(
@@ -1,12 +1,12 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # With subscription_delay
4
- source = RxRuby::Observable
4
+ source = Rx::Observable
5
5
  .range(0, 3)
6
6
  .delay_with_selector(
7
- RxRuby::Observable.timer(0.3),
7
+ Rx::Observable.timer(0.3),
8
8
  lambda {|x|
9
- return RxRuby::Observable.timer(x * 0.4)
9
+ return Rx::Observable.timer(x * 0.4)
10
10
  }
11
11
  )
12
12
  .time_interval
@@ -33,11 +33,11 @@ while Thread.list.size > 1
33
33
  end
34
34
 
35
35
  # Without subscription_delay
36
- source = RxRuby::Observable
36
+ source = Rx::Observable
37
37
  .range(0, 3)
38
38
  .delay_with_selector(
39
39
  lambda {|x|
40
- return RxRuby::Observable.timer(x * 0.4)
40
+ return Rx::Observable.timer(x * 0.4)
41
41
  })
42
42
  .time_interval
43
43
  .map {|x| x.value.to_s + ':' + x.interval.to_s }
@@ -1,9 +1,9 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable
3
+ source = Rx::Observable
4
4
  .from_array([
5
- RxRuby::Notification.create_on_next(42),
6
- RxRuby::Notification.create_on_error(Exception.new('woops'))
5
+ Rx::Notification.create_on_next(42),
6
+ Rx::Notification.create_on_error(Exception.new('woops'))
7
7
  ])
8
8
  .dematerialize
9
9
 
@@ -1,12 +1,12 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- disposable = RxRuby::Disposable.create {
3
+ disposable = Rx::Disposable.create {
4
4
  puts 'disposed'
5
5
  }
6
6
 
7
7
  disposable.dispose
8
8
  # => disposed
9
9
 
10
- disposable = RxRuby::Disposable.empty
10
+ disposable = Rx::Disposable.empty
11
11
 
12
12
  disposable.dispose # Does nothing
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without key selector
4
- source = RxRuby::Observable.from_array([
4
+ source = Rx::Observable.from_array([
5
5
  42, 24, 42, 24
6
6
  ])
7
7
  .distinct
@@ -22,7 +22,7 @@ subscription = source.subscribe(
22
22
  # => Completed
23
23
 
24
24
  # With key selector
25
- source = RxRuby::Observable.from_array([
25
+ source = Rx::Observable.from_array([
26
26
  {value: 42}, {value: 24}, {value: 42}, {value: 24}
27
27
  ])
28
28
  .distinct {|x| x[:value] }
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Without key selector
4
- source = RxRuby::Observable.from_array([
4
+ source = Rx::Observable.from_array([
5
5
  42, 42, 24, 24
6
6
  ])
7
7
  .distinct_until_changed
@@ -22,7 +22,7 @@ subscription = source.subscribe(
22
22
  # => Completed
23
23
 
24
24
  # With key selector
25
- source = RxRuby::Observable.from_array([
25
+ source = Rx::Observable.from_array([
26
26
  {value: 42}, {value: 42}, {value: 24}, {value: 24}
27
27
  ])
28
28
  .distinct_until_changed {|x| x[:value] }
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using a function
4
- source = RxRuby::Observable.range(0, 3)
4
+ source = Rx::Observable.range(0, 3)
5
5
  .do(
6
6
  lambda {|x| puts 'Do Next:' + x.to_s },
7
7
  lambda {|err| puts 'Do Error:' + err.to_s },
@@ -29,13 +29,13 @@ subscription = source.subscribe(
29
29
  # => Completed
30
30
 
31
31
  # Using an observer
32
- observer = RxRuby::Observer.create(
32
+ observer = Rx::Observer.create(
33
33
  lambda {|x| puts 'Do Next: ' + x.to_s },
34
34
  lambda {|err| puts 'Do Error: ' + err.to_s },
35
35
  lambda { puts 'Do Completed' }
36
36
  )
37
37
 
38
- source = RxRuby::Observable.range(0, 3)
38
+ source = Rx::Observable.range(0, 3)
39
39
  .do(observer)
40
40
 
41
41
  subscription = source.subscribe(
@@ -1,6 +1,6 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable.empty
3
+ source = Rx::Observable.empty
4
4
 
5
5
  subscription = source.subscribe(
6
6
  lambda {|x|
@@ -1,12 +1,12 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using Observables
4
4
  array = [1, 2, 3]
5
5
 
6
- source = RxRuby::Observable.for(
6
+ source = Rx::Observable.for(
7
7
  array,
8
8
  lambda {|x|
9
- RxRuby::Observable.return(x)
9
+ Rx::Observable.return(x)
10
10
  })
11
11
 
12
12
  subscription = source.subscribe(
@@ -1,11 +1,11 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using observables and Promises
4
- source = RxRuby::Observable.fork_join(
5
- RxRuby::Observable.return(42),
6
- RxRuby::Observable.range(0, 10),
7
- RxRuby::Observable.from_array([1,2,3]),
8
- RxRuby::Observable.return(56)
4
+ source = Rx::Observable.fork_join(
5
+ Rx::Observable.return(42),
6
+ Rx::Observable.range(0, 10),
7
+ Rx::Observable.from_array([1,2,3]),
8
+ Rx::Observable.return(56)
9
9
  )
10
10
 
11
11
  subscription = source.subscribe(
@@ -1,8 +1,8 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Array-like object (arguments) to Observable
4
4
  def f(*arguments)
5
- RxRuby::Observable.from(arguments)
5
+ Rx::Observable.from(arguments)
6
6
  end
7
7
 
8
8
  f(1, 2, 3).subscribe(
@@ -23,7 +23,7 @@ f(1, 2, 3).subscribe(
23
23
 
24
24
  # Any iterable object...
25
25
  s = ["foo", :window]
26
- RxRuby::Observable.from(s).subscribe(
26
+ Rx::Observable.from(s).subscribe(
27
27
  lambda {|x|
28
28
  puts 'Next: ' + x.to_s
29
29
  },
@@ -39,7 +39,7 @@ RxRuby::Observable.from(s).subscribe(
39
39
 
40
40
  # Map
41
41
  m = {1 => 2, 2 => 4, 4 => 8}
42
- RxRuby::Observable.from(m).subscribe(
42
+ Rx::Observable.from(m).subscribe(
43
43
  lambda {|x|
44
44
  puts 'Next: ' + x.to_s
45
45
  },
@@ -55,7 +55,7 @@ RxRuby::Observable.from(m).subscribe(
55
55
  # => Completed
56
56
 
57
57
  # String
58
- RxRuby::Observable.from("foo".to_enum(:each_char)).subscribe(
58
+ Rx::Observable.from("foo".to_enum(:each_char)).subscribe(
59
59
  lambda {|x|
60
60
  puts 'Next: ' + x.to_s
61
61
  },
@@ -72,7 +72,7 @@ RxRuby::Observable.from("foo".to_enum(:each_char)).subscribe(
72
72
 
73
73
  # Using an arrow function as the map function to
74
74
  # manipulate the elements
75
- RxRuby::Observable.from([1, 2, 3], lambda {|x, i| x + x }).subscribe(
75
+ Rx::Observable.from([1, 2, 3], lambda {|x, i| x + x }).subscribe(
76
76
  lambda {|x|
77
77
  puts 'Next: ' + x.to_s
78
78
  },
@@ -88,7 +88,7 @@ RxRuby::Observable.from([1, 2, 3], lambda {|x, i| x + x }).subscribe(
88
88
  # => Completed
89
89
 
90
90
  # Generate a sequence of numbers
91
- RxRuby::Observable.from(5.times, lambda {|v, k| k }).subscribe(
91
+ Rx::Observable.from(5.times, lambda {|v, k| k }).subscribe(
92
92
  lambda {|x|
93
93
  puts 'Next: ' + x.to_s
94
94
  },
@@ -1,8 +1,8 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  array = [1,2,3]
4
4
 
5
- source = RxRuby::Observable.from_array(array)
5
+ source = Rx::Observable.from_array(array)
6
6
 
7
7
  subscription = source.subscribe(
8
8
  lambda {|x|
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Wrap fs.exists
4
- exists = RxRuby::Observable.from_callback(File.method(:exist?))
4
+ exists = Rx::Observable.from_callback(File.method(:exist?))
5
5
 
6
6
  # Check if file.txt exists
7
7
  source = exists.call('file.txt')
@@ -1,6 +1,6 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable.generate(
3
+ source = Rx::Observable.generate(
4
4
  0,
5
5
  lambda {|x| x < 3 }, # condition
6
6
  lambda {|x| x + 1 }, # iterate
@@ -1,15 +1,15 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- xs = RxRuby::Observable.interval(0.1)
3
+ xs = Rx::Observable.interval(0.1)
4
4
  .map {|x| 'first' + x.to_s }
5
5
 
6
- ys = RxRuby::Observable.interval(0.1)
6
+ ys = Rx::Observable.interval(0.1)
7
7
  .map {|x| 'second' + x.to_s }
8
8
 
9
9
  source = xs.group_join(
10
10
  ys,
11
- lambda {|_| return RxRuby::Observable.timer(0) },
12
- lambda {|_| return RxRuby::Observable.timer(0) },
11
+ lambda {|_| return Rx::Observable.timer(0) },
12
+ lambda {|_| return Rx::Observable.timer(0) },
13
13
  lambda {|x, yy|
14
14
  return yy.map {|y|
15
15
  x + y
@@ -1,11 +1,11 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # This uses and only then source
4
4
  should_run = true
5
5
 
6
- source = RxRuby::Observable.if(
6
+ source = Rx::Observable.if(
7
7
  lambda { return should_run },
8
- RxRuby::Observable.return(42)
8
+ Rx::Observable.return(42)
9
9
  )
10
10
 
11
11
  subscription = source.subscribe(
@@ -25,10 +25,10 @@ subscription = source.subscribe(
25
25
  # The next example uses an elseSource
26
26
  should_run = false
27
27
 
28
- source = RxRuby::Observable.if(
28
+ source = Rx::Observable.if(
29
29
  lambda { return should_run },
30
- RxRuby::Observable.return(42),
31
- RxRuby::Observable.return(56)
30
+ Rx::Observable.return(42),
31
+ Rx::Observable.return(56)
32
32
  )
33
33
 
34
34
  subscription = source.subscribe(
@@ -1,6 +1,6 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable
3
+ source = Rx::Observable
4
4
  .interval(0.5) # ms
5
5
  .time_interval
6
6
  .take(3)
@@ -1,15 +1,15 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source1 = RxRuby::Observable.interval(0.1)
3
+ source1 = Rx::Observable.interval(0.1)
4
4
  .time_interval()
5
5
  .pluck('interval')
6
6
  .take(3)
7
- source2 = RxRuby::Observable.interval(0.15)
7
+ source2 = Rx::Observable.interval(0.15)
8
8
  .time_interval()
9
9
  .pluck('interval')
10
10
  .take(2)
11
11
 
12
- source = RxRuby::Observable.merge(
12
+ source = Rx::Observable.merge(
13
13
  source1,
14
14
  source2)
15
15
 
@@ -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
  .merge_all
6
6
 
7
7
  subscription = source.subscribe(
@@ -1,10 +1,10 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- subject = RxRuby::Subject.new
4
- source = RxRuby::Observable.range(0, 3)
3
+ subject = Rx::Subject.new
4
+ source = Rx::Observable.range(0, 3)
5
5
  .multicast(subject)
6
6
 
7
- observer = RxRuby::Observer.create(
7
+ observer = Rx::Observer.create(
8
8
  lambda {|x|
9
9
  puts 'Next: ' + x.to_s
10
10
  },
@@ -1,7 +1,7 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # This will never produce a value, hence never calling any of the callbacks
4
- source = RxRuby::Observable.never
4
+ source = Rx::Observable.never
5
5
 
6
6
  subscription = source.subscribe(
7
7
  lambda {|x|
@@ -1,6 +1,6 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source = RxRuby::Observable.of(1,2,3)
3
+ source = Rx::Observable.of(1,2,3)
4
4
 
5
5
  subscription = source.subscribe(
6
6
  lambda {|x|
@@ -1,10 +1,10 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
- source1 = RxRuby::Observable.raise_error(Exception.new('error 1'))
4
- source2 = RxRuby::Observable.raise_error(Exception.new('error 2'))
5
- source3 = RxRuby::Observable.return(42)
3
+ source1 = Rx::Observable.raise_error(Exception.new('error 1'))
4
+ source2 = Rx::Observable.raise_error(Exception.new('error 2'))
5
+ source3 = Rx::Observable.return(42)
6
6
 
7
- source = RxRuby::Observable.on_error_resume_next(source1, source2, source3)
7
+ source = Rx::Observable.on_error_resume_next(source1, source2, source3)
8
8
 
9
9
  subscription = source.subscribe(
10
10
  lambda {|x|
@@ -1,4 +1,4 @@
1
- require 'rx_ruby'
1
+ require 'rx'
2
2
 
3
3
  # Using Standard JavaScript
4
4
  obj = {
@@ -7,7 +7,7 @@ obj = {
7
7
  baz: 78
8
8
  }
9
9
 
10
- source = RxRuby::Observable.pairs(obj)
10
+ source = Rx::Observable.pairs(obj)
11
11
 
12
12
  subscription = source.subscribe(
13
13
  lambda {|x|