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,4 +1,4 @@
1
- module RxRuby
1
+ module Rx
2
2
  class << Observable
3
3
  def while(condition, source)
4
4
  enum = Enumerator.new {|y|
@@ -1,18 +1,18 @@
1
1
  # Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  require 'thread'
4
- require 'rx_ruby/subscriptions/composite_subscription'
5
- require 'rx_ruby/core/observer'
6
- require 'rx_ruby/core/observable'
7
- require 'rx_ruby/operators/single'
8
- require 'rx_ruby/operators/standard_query_operators'
4
+ require 'rx/subscriptions/composite_subscription'
5
+ require 'rx/core/observer'
6
+ require 'rx/core/observable'
7
+ require 'rx/operators/single'
8
+ require 'rx/operators/standard_query_operators'
9
9
 
10
- module RxRuby
10
+ module Rx
11
11
 
12
12
  module Observable
13
13
 
14
14
  # Internal method to get the final value
15
- # @return [RxRuby::Observable]
15
+ # @return [Rx::Observable]
16
16
  def final
17
17
  AnonymousObservable.new do |observer|
18
18
  value = nil
@@ -42,8 +42,8 @@ module RxRuby
42
42
 
43
43
  # Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single
44
44
  # element in the result sequence. The specified seed value is used as the initial accumulator value.
45
- # For aggregation behavior with incremental intermediate results, see RxRuby::Observable.scan
46
- # @return [RxRuby::Observable]
45
+ # For aggregation behavior with incremental intermediate results, see Rx::Observable.scan
46
+ # @return [Rx::Observable]
47
47
  def reduce(*args, &block)
48
48
  # Argument parsing to support:
49
49
  # 1. (seed, Symbol) || (seed, &block)
@@ -60,7 +60,7 @@ module RxRuby
60
60
  # Determines whether all elements of an observable sequence satisfy a condition if block given, else if all are
61
61
  # true
62
62
  # @param [Proc] block
63
- # @return [RxRuby::Observable]
63
+ # @return [Rx::Observable]
64
64
  def all?(&block)
65
65
  block ||= lambda { |_| true }
66
66
  select {|v| !(block.call v)}.
@@ -71,7 +71,7 @@ module RxRuby
71
71
  # Determines whether no elements of an observable sequence satisfy a condition if block given, else if all are
72
72
  # false
73
73
  # @param [Proc] block
74
- # @return [RxRuby::Observable]
74
+ # @return [Rx::Observable]
75
75
  def none?(&block)
76
76
  block ||= lambda { |_| true }
77
77
  select {|v| !(block.call v)}.
@@ -80,7 +80,7 @@ module RxRuby
80
80
 
81
81
  # Determines whether any element of an observable sequence satisfies a condition if a block is given else if
82
82
  # there are any items in the observable sequence.
83
- # @return [RxRuby::Observable]
83
+ # @return [Rx::Observable]
84
84
  def any?(&block)
85
85
  return map(&block).any? if block_given?
86
86
  AnonymousObservable.new do |observer|
@@ -105,7 +105,7 @@ module RxRuby
105
105
  # Computes the average of an observable sequence of values that are optionally obtained by invoking a
106
106
  # transform function on each element of the input sequence if a block is given
107
107
  # @param [Object] block
108
- # @return [RxRuby::Observable]
108
+ # @return [Rx::Observable]
109
109
  def average(&block)
110
110
  return map(&block).average if block_given?
111
111
  scan({:sum => 0, :count => 0}) {|prev, current| {:sum => prev[:sum] + current, :count => prev[:count] + 1 }}.
@@ -118,7 +118,7 @@ module RxRuby
118
118
 
119
119
  # Determines whether an observable sequence contains a specified element.
120
120
  # @param [Object] item The value to locate in the source sequence.
121
- # @return [RxRuby::Observable] An observable sequence containing a single element determining whether the source
121
+ # @return [Rx::Observable] An observable sequence containing a single element determining whether the source
122
122
  # sequence contains an element that has the specified value.
123
123
  def contains?(item)
124
124
  select {|x| x.eql? item}.any?
@@ -134,7 +134,7 @@ module RxRuby
134
134
 
135
135
  # Returns the element at a specified index in a sequence.
136
136
  # @param [Numeric] index The zero-based index of the element to retrieve.
137
- # @return [RxRuby::Observable] An observable sequence that produces the element at the specified position in the
137
+ # @return [Rx::Observable] An observable sequence that produces the element at the specified position in the
138
138
  # source sequence.
139
139
  def element_at(index)
140
140
  raise ArgumentError.new 'index cannot be less than zero' if index < 0
@@ -190,7 +190,7 @@ module RxRuby
190
190
  # Returns the first element of an observable sequence that satisfies the condition in the predicate if a block is
191
191
  # given, else the first item in the observable sequence.
192
192
  # @param [Proc] block Optional predicate function to evaluate for elements in the source sequence.
193
- # @return [RxRuby::Observable] Sequence containing the first element in the observable sequence that satisfies the
193
+ # @return [Rx::Observable] Sequence containing the first element in the observable sequence that satisfies the
194
194
  # condition in the predicate if a block is given, else the first element.
195
195
  def first(&block)
196
196
  return select(&block).first if block_given?
@@ -213,7 +213,7 @@ module RxRuby
213
213
  # or a default value if no such element exists.
214
214
  # @param [Object] default_value The default value to use if the sequence is empty.
215
215
  # @param [Proc] block An optional predicate function to evaluate for elements in the source sequence.
216
- # @return [RxRuby::Observable] Sequence containing the first element in the observable sequence that satisfies the
216
+ # @return [Rx::Observable] Sequence containing the first element in the observable sequence that satisfies the
217
217
  # condition in the predicate if given, or a default value if no such element exists.
218
218
  def first_or_default(default_value = nil, &block)
219
219
  return select(&block).first_or_default(default_value) if block_given?
@@ -237,7 +237,7 @@ module RxRuby
237
237
  end
238
238
 
239
239
  # Determines whether an observable sequence is empty.
240
- # @return [RxRuby::Observable] An observable sequence containing a single element determining whether the source
240
+ # @return [Rx::Observable] An observable sequence containing a single element determining whether the source
241
241
  # sequence is empty.
242
242
  def empty?
243
243
  any?.map {|b| !b }
@@ -246,7 +246,7 @@ module RxRuby
246
246
  # Returns the last element of an observable sequence that satisfies the condition in the predicate if the block is
247
247
  # given, else the last element in the observable sequence.
248
248
  # @param [Proc] block An predicate function to evaluate for elements in the source sequence.
249
- # @return {RxRuby::Observable} Sequence containing the last element in the observable sequence that satisfies the
249
+ # @return {Rx::Observable} Sequence containing the last element in the observable sequence that satisfies the
250
250
  # condition in the predicate if given, or the last element in the observable sequence.
251
251
  def last(&block)
252
252
  return select(&block).last if block_given?
@@ -281,7 +281,7 @@ module RxRuby
281
281
  # a default value if no such element exists.
282
282
  # @param [Object] default_value The default value to use if the sequence is empty.
283
283
  # @param [Proc] block An predicate function to evaluate for elements in the source sequence.
284
- # @return {RxRuby::Observable} Sequence containing the last element in the observable sequence that satisfies the
284
+ # @return {Rx::Observable} Sequence containing the last element in the observable sequence that satisfies the
285
285
  # condition in the predicate if given, or a default value if no such element exists.
286
286
  def last_or_default(default_value = nil, &block)
287
287
  return select(&block).last_or_default(default_value) if block_given?
@@ -310,7 +310,7 @@ module RxRuby
310
310
 
311
311
  # Returns the maximum element in an observable sequence.
312
312
  # @param [Proc] block An optional selector function to produce an element.
313
- # @return [RxRuby::Observable] The maximum element in an observable sequence.
313
+ # @return [Rx::Observable] The maximum element in an observable sequence.
314
314
  def max(&block)
315
315
  return map(&block).max if block_given?
316
316
  max_by {x| x} .map {|x| x[0] }
@@ -318,7 +318,7 @@ module RxRuby
318
318
 
319
319
  # Returns the elements in an observable sequence with the maximum key value.
320
320
  # @param [Proc] block Key selector function.
321
- # @return [RxRuby::Observable] An observable sequence containing a list of zero or more elements that have a maximum
321
+ # @return [Rx::Observable] An observable sequence containing a list of zero or more elements that have a maximum
322
322
  # key value.
323
323
  def max_by(&block)
324
324
  extrema_by(&block)
@@ -326,7 +326,7 @@ module RxRuby
326
326
 
327
327
  # Returns the minimum element in an observable sequence.
328
328
  # @param [Proc] block An optional selector function to produce an element.
329
- # @return [RxRuby::Observable] The minimum element in an observable sequence.
329
+ # @return [Rx::Observable] The minimum element in an observable sequence.
330
330
  def min(&block)
331
331
  return map(&block).min if block_given?
332
332
  min_by {|x| x} .map {|x| x[0] }
@@ -334,15 +334,15 @@ module RxRuby
334
334
 
335
335
  # Returns the elements in an observable sequence with the minimum key value.
336
336
  # @param [Proc] block Key selector function.
337
- # @return [RxRuby::Observable] >An observable sequence containing a list of zero or more elements that have a
337
+ # @return [Rx::Observable] >An observable sequence containing a list of zero or more elements that have a
338
338
  # minimum key value.
339
339
  def min_by(&block)
340
340
  extrema_by(true, &block)
341
341
  end
342
342
 
343
343
  # Determines whether two sequences are equal by comparing the elements pairwise.
344
- # @param [RxRuby::Observable] other Other observable sequence to compare.
345
- # @return [RxRuby::Observable] An observable sequence that contains a single element which indicates whether both
344
+ # @param [Rx::Observable] other Other observable sequence to compare.
345
+ # @return [Rx::Observable] An observable sequence that contains a single element which indicates whether both
346
346
  # sequences are of equal length and their corresponding elements are equal.
347
347
  def sequence_eql?(other)
348
348
  AnonymousObservable.new do |observer|
@@ -439,7 +439,7 @@ module RxRuby
439
439
  # Returns the only element of an observable sequence, and reports an exception if there is not exactly one
440
440
  # element in the observable sequence.
441
441
  # @param [Proc] block A predicate function to evaluate for elements in the source sequence.
442
- # @return [RxRuby::Observable] >Sequence containing the single element in the observable sequence.
442
+ # @return [Rx::Observable] >Sequence containing the single element in the observable sequence.
443
443
  def single(&block)
444
444
  return select(&block).single if block_given?
445
445
  AnonymousObservable.new do |observer|
@@ -476,7 +476,7 @@ module RxRuby
476
476
  # this method reports an exception if there is more than one element in the observable sequence.
477
477
  # @param [Object] default_value The default value if no value is provided
478
478
  # @param [Proc] block A predicate function to evaluate for elements in the source sequence.
479
- # @return [RxRuby::Observable] Sequence containing the single element in the observable sequence, or a default value
479
+ # @return [Rx::Observable] Sequence containing the single element in the observable sequence, or a default value
480
480
  # if no such element exists.
481
481
  def single_or_default(default_value = nil, &block)
482
482
  return select(&block).single_or_default(default_value) if block_given?
@@ -508,7 +508,7 @@ module RxRuby
508
508
 
509
509
  # Computes the sum of a sequence of values.
510
510
  # @param [Proc] block Optional block used to obtain the value to sum.
511
- # @return [RxRuby::Observable] An observable sequence containing a single element with the sum of the values in the
511
+ # @return [Rx::Observable] An observable sequence containing a single element with the sum of the values in the
512
512
  # source sequence.
513
513
  def sum(&block)
514
514
  return map(&block).sum if block_given?
@@ -516,7 +516,7 @@ module RxRuby
516
516
  end
517
517
 
518
518
  # Creates an array from an observable sequence.
519
- # @return [RxRuby::Observable] An array created from an observable sequence.
519
+ # @return [Rx::Observable] An array created from an observable sequence.
520
520
  def to_a
521
521
  AnonymousObservable.new do |observer|
522
522
  arr = []
@@ -550,7 +550,7 @@ module RxRuby
550
550
  end
551
551
 
552
552
  # Creates a Hash from the observable collection. Note that any duplicate keys will be overwritten.
553
- # @return [RxRuby::Observable] A Hash created from an observable sequence.
553
+ # @return [Rx::Observable] A Hash created from an observable sequence.
554
554
  def to_h
555
555
  h = HashConfiguration.new
556
556
  yield h if block_given?
@@ -1,11 +1,11 @@
1
1
  # Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
- require 'rx_ruby/concurrency/current_thread_scheduler'
4
- require 'rx_ruby/concurrency/immediate_scheduler'
5
- require 'rx_ruby/subscriptions/composite_subscription'
6
- require 'rx_ruby/subscriptions/subscription'
3
+ require 'rx/concurrency/current_thread_scheduler'
4
+ require 'rx/concurrency/immediate_scheduler'
5
+ require 'rx/subscriptions/composite_subscription'
6
+ require 'rx/subscriptions/subscription'
7
7
 
8
- module RxRuby
8
+ module Rx
9
9
 
10
10
  module Observable
11
11
 
@@ -76,7 +76,7 @@ module RxRuby
76
76
  end
77
77
  rescue => err
78
78
  observer.on_error err
79
- return
79
+ break
80
80
  end
81
81
  if has_result
82
82
  observer.on_next result
@@ -1,16 +1,16 @@
1
1
  # Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  require 'monitor'
4
- require 'rx_ruby/concurrency/async_lock'
5
- require 'rx_ruby/subscriptions/subscription'
6
- require 'rx_ruby/subscriptions/composite_subscription'
7
- require 'rx_ruby/subscriptions/ref_count_subscription'
8
- require 'rx_ruby/subscriptions/single_assignment_subscription'
9
- require 'rx_ruby/core/observer'
10
- require 'rx_ruby/core/observable'
11
- require 'rx_ruby/operators/creation'
4
+ require 'rx/concurrency/async_lock'
5
+ require 'rx/subscriptions/subscription'
6
+ require 'rx/subscriptions/composite_subscription'
7
+ require 'rx/subscriptions/ref_count_subscription'
8
+ require 'rx/subscriptions/single_assignment_subscription'
9
+ require 'rx/core/observer'
10
+ require 'rx/core/observable'
11
+ require 'rx/operators/creation'
12
12
 
13
- module RxRuby
13
+ module Rx
14
14
 
15
15
  module Observable
16
16
 
@@ -141,7 +141,7 @@ module RxRuby
141
141
  res = result_selector.call left, right
142
142
  rescue => e
143
143
  observer.on_error e
144
- return
144
+ break
145
145
  end
146
146
  observer.on_next res
147
147
  end
@@ -168,7 +168,7 @@ module RxRuby
168
168
  res = result_selector.call left, right
169
169
  rescue => e
170
170
  observer.on_error e
171
- return
171
+ break
172
172
  end
173
173
  observer.on_next res
174
174
  end
@@ -443,7 +443,7 @@ module RxRuby
443
443
  error = nil
444
444
 
445
445
  if disposed
446
- return
446
+ break
447
447
  else
448
448
  begin
449
449
  current = e.next
@@ -457,7 +457,7 @@ module RxRuby
457
457
 
458
458
  if error
459
459
  observer.on_error error
460
- return
460
+ break
461
461
  end
462
462
 
463
463
  unless has_next
@@ -466,7 +466,7 @@ module RxRuby
466
466
  else
467
467
  observer.on_completed
468
468
  end
469
- return
469
+ break
470
470
  end
471
471
 
472
472
  new_obs = Observer.configure do |o|
@@ -510,13 +510,13 @@ module RxRuby
510
510
  res = result_selector.call(*values)
511
511
  rescue => e
512
512
  observer.on_error e
513
- return
513
+ break
514
514
  end
515
515
 
516
516
  observer.on_next(res)
517
517
  elsif enumerable_select_with_index(is_done) {|_, j| j != i} .all?
518
518
  observer.on_completed
519
- return
519
+ break
520
520
  end
521
521
  end
522
522
 
@@ -564,7 +564,7 @@ module RxRuby
564
564
  err = nil
565
565
 
566
566
  if disposed
567
- return
567
+ break
568
568
  else
569
569
  begin
570
570
  current = e.next
@@ -578,12 +578,12 @@ module RxRuby
578
578
 
579
579
  if err
580
580
  observer.on_error err
581
- return
581
+ break
582
582
  end
583
583
 
584
584
  unless has_next
585
585
  observer.on_completed
586
- return
586
+ break
587
587
  end
588
588
 
589
589
  d = SingleAssignmentSubscription.new
@@ -631,7 +631,6 @@ module RxRuby
631
631
  current = nil
632
632
  has_next = false
633
633
  err = nil
634
-
635
634
  if !disposed
636
635
  begin
637
636
  current = e.next
@@ -642,17 +641,17 @@ module RxRuby
642
641
  err = e
643
642
  end
644
643
  else
645
- return
644
+ break
646
645
  end
647
646
 
648
647
  if err
649
648
  observer.on_error err
650
- return
649
+ break
651
650
  end
652
651
 
653
652
  unless has_next
654
653
  observer.on_completed
655
- return
654
+ break
656
655
  end
657
656
 
658
657
  d = SingleAssignmentSubscription.new
@@ -1,14 +1,14 @@
1
1
  # Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
- require 'rx_ruby/subscriptions/subscription'
4
- require 'rx_ruby/subscriptions/composite_subscription'
5
- require 'rx_ruby/subscriptions/ref_count_subscription'
6
- require 'rx_ruby/subscriptions/single_assignment_subscription'
7
- require 'rx_ruby/core/observer'
8
- require 'rx_ruby/core/observable'
9
- require 'rx_ruby/operators/creation'
3
+ require 'rx/subscriptions/subscription'
4
+ require 'rx/subscriptions/composite_subscription'
5
+ require 'rx/subscriptions/ref_count_subscription'
6
+ require 'rx/subscriptions/single_assignment_subscription'
7
+ require 'rx/core/observer'
8
+ require 'rx/core/observable'
9
+ require 'rx/operators/creation'
10
10
 
11
- module RxRuby
11
+ module Rx
12
12
 
13
13
  module Observable
14
14
 
@@ -28,7 +28,7 @@ module RxRuby
28
28
  def dematerialize
29
29
  AnonymousObservable.new do |observer|
30
30
 
31
- new_obs = RxRuby::Observer.configure do |o|
31
+ new_obs = Rx::Observer.configure do |o|
32
32
  o.on_next {|x| x.accept observer }
33
33
  o.on_error(&observer.method(:on_error))
34
34
  o.on_completed(&observer.method(:on_completed))
@@ -45,7 +45,7 @@ module RxRuby
45
45
  current_key = nil
46
46
  has_current = nil
47
47
 
48
- new_obs = RxRuby::Observer.configure do |o|
48
+ new_obs = Rx::Observer.configure do |o|
49
49
  o.on_next do |value|
50
50
  key = nil
51
51
  begin
@@ -75,7 +75,7 @@ module RxRuby
75
75
  def tap(observer)
76
76
  raise ArgumentError.new 'Observer cannot be nil' unless observer
77
77
  AnonymousObservable.new do |obs|
78
- new_obs = RxRuby::Observer.configure do |o|
78
+ new_obs = Rx::Observer.configure do |o|
79
79
 
80
80
  o.on_next do |value|
81
81
  begin
@@ -130,7 +130,7 @@ module RxRuby
130
130
  # Ignores all elements in an observable sequence leaving only the termination messages.
131
131
  def ignore_elements
132
132
  AnonymousObservable.new do |observer|
133
- new_obs = RxRuby::Observer.configure do |o|
133
+ new_obs = Rx::Observer.configure do |o|
134
134
  o.on_next {|_| }
135
135
  o.on_error(&observer.method(:on_error))
136
136
  o.on_completed(&observer.method(:on_completed))
@@ -143,7 +143,7 @@ module RxRuby
143
143
  # Materializes the implicit notifications of an observable sequence as explicit notification values.
144
144
  def materialize
145
145
  AnonymousObservable.new do |observer|
146
- new_obs = RxRuby::Observer.configure do |o|
146
+ new_obs = Rx::Observer.configure do |o|
147
147
 
148
148
  o.on_next {|x| observer.on_next(Notification.create_on_next x) }
149
149
 
@@ -230,7 +230,7 @@ module RxRuby
230
230
  end
231
231
  rescue => err
232
232
  observer.on_error err
233
- return
233
+ break
234
234
  end
235
235
 
236
236
  observer.on_next accumulation