rx 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +1 -1
- data/examples/aggregate.rb +3 -3
- data/examples/amb.rb +4 -4
- data/examples/ambproto.rb +3 -3
- data/examples/and.rb +4 -4
- data/examples/as_observable.rb +2 -2
- data/examples/average.rb +3 -3
- data/examples/buffer_with_count.rb +3 -3
- data/examples/buffer_with_time.rb +3 -3
- data/examples/case.rb +5 -5
- data/examples/catch.rb +4 -4
- data/examples/catchproto.rb +5 -5
- data/examples/combine_latest.rb +4 -4
- data/examples/combine_latestproto.rb +3 -3
- data/examples/concat.rb +4 -4
- data/examples/concat_all.rb +3 -3
- data/examples/concat_map.rb +4 -4
- data/examples/concat_map_observer.rb +5 -5
- data/examples/concatproto.rb +3 -3
- data/examples/connect.rb +3 -3
- data/examples/contains.rb +3 -3
- data/examples/count.rb +3 -3
- data/examples/create.rb +4 -4
- data/examples/debounce.rb +3 -3
- data/examples/default_if_empty.rb +3 -3
- data/examples/defer.rb +3 -3
- data/examples/delay.rb +3 -3
- data/examples/delay_with_selector.rb +6 -6
- data/examples/dematerialize.rb +4 -4
- data/examples/disposable.rb +3 -3
- data/examples/distinct.rb +3 -3
- data/examples/distinct_until_changed.rb +3 -3
- data/examples/do.rb +4 -4
- data/examples/empty.rb +2 -2
- data/examples/for.rb +3 -3
- data/examples/fork_join.rb +6 -6
- data/examples/from.rb +7 -7
- data/examples/from_array.rb +2 -2
- data/examples/from_callback.rb +2 -2
- data/examples/generate.rb +2 -2
- data/examples/group_join.rb +5 -5
- data/examples/if.rb +6 -6
- data/examples/intervals.rb +2 -2
- data/examples/merge.rb +4 -4
- data/examples/merge_all.rb +3 -3
- data/examples/multicast.rb +4 -4
- data/examples/never.rb +2 -2
- data/examples/of.rb +2 -2
- data/examples/on_error_resume_next.rb +5 -5
- data/examples/pairs.rb +2 -2
- data/examples/publish.rb +5 -5
- data/examples/range.rb +2 -2
- data/examples/reduce.rb +2 -2
- data/examples/repeat.rb +2 -2
- data/examples/return.rb +2 -2
- data/examples/scan.rb +3 -3
- data/examples/start.rb +3 -3
- data/examples/throw.rb +3 -3
- data/examples/time_intervals.rb +2 -2
- data/examples/timer.rb +2 -2
- data/examples/timestamp.rb +2 -2
- data/examples/to_a.rb +2 -2
- data/examples/to_async.rb +2 -2
- data/examples/using.rb +3 -3
- data/examples/when.rb +4 -4
- data/examples/while.rb +3 -3
- data/examples/window_with_time.rb +3 -3
- data/examples/zip.rb +3 -3
- data/examples/zip_array.rb +3 -3
- data/lib/core_ext/enumerable.rb +3 -3
- data/lib/{rx_ruby.rb → rx.rb} +11 -11
- data/lib/{rx_ruby → rx}/concurrency/async_lock.rb +1 -1
- data/lib/{rx_ruby → rx}/concurrency/current_thread_scheduler.rb +6 -6
- data/lib/{rx_ruby → rx}/concurrency/default_scheduler.rb +8 -8
- data/lib/{rx_ruby → rx}/concurrency/historical_scheduler.rb +3 -3
- data/lib/{rx_ruby → rx}/concurrency/immediate_scheduler.rb +4 -4
- data/lib/{rx_ruby → rx}/concurrency/local_scheduler.rb +3 -3
- data/lib/{rx_ruby → rx}/concurrency/periodic_scheduler.rb +1 -1
- data/lib/{rx_ruby → rx}/concurrency/scheduled_item.rb +2 -2
- data/lib/{rx_ruby → rx}/concurrency/scheduler.rb +1 -1
- data/lib/{rx_ruby → rx}/concurrency/virtual_time_scheduler.rb +4 -4
- data/lib/{rx_ruby → rx}/core/async_lock_observer.rb +4 -4
- data/lib/{rx_ruby → rx}/core/auto_detach_observer.rb +4 -4
- data/lib/{rx_ruby → rx}/core/checked_observer.rb +2 -2
- data/lib/{rx_ruby → rx}/core/notification.rb +3 -3
- data/lib/{rx_ruby → rx}/core/observable.rb +6 -6
- data/lib/{rx_ruby → rx}/core/observe_on_observer.rb +2 -2
- data/lib/{rx_ruby → rx}/core/observer.rb +1 -1
- data/lib/{rx_ruby → rx}/core/scheduled_observer.rb +3 -3
- data/lib/{rx_ruby → rx}/core/synchronized_observer.rb +3 -3
- data/lib/{rx_ruby → rx}/core/time_interval.rb +1 -1
- data/lib/{rx_ruby → rx}/internal/priority_queue.rb +1 -1
- data/lib/{rx_ruby → rx}/internal/util.rb +1 -1
- data/lib/{rx_ruby → rx}/joins/active_plan.rb +1 -1
- data/lib/{rx_ruby → rx}/joins/join_observer.rb +1 -1
- data/lib/{rx_ruby → rx}/joins/pattern.rb +1 -1
- data/lib/{rx_ruby → rx}/joins/plan.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/connectable_observable.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/_observable_timer_date_and_period.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/_observable_timer_time_span.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/_observable_timer_time_span_and_period.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/aggregate.rb +2 -2
- data/lib/{rx_ruby → rx}/linq/observable/and.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/case.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/concat_all.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/concat_map.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/concat_map_observer.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/contains.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/debounce.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/delay.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/delay_with_selector.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/do.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/for.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/fork_join.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/from.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/group_join.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/if.rb +1 -1
- data/lib/rx/linq/observable/interval.rb +5 -0
- data/lib/{rx_ruby → rx}/linq/observable/multicast.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/of.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/pairs.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/pluck.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/publish.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/start.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/time_interval.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/timer.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/timestamp.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/to_async.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/when.rb +1 -1
- data/lib/{rx_ruby → rx}/linq/observable/while.rb +1 -1
- data/lib/{rx_ruby → rx}/operators/aggregates.rb +31 -31
- data/lib/{rx_ruby → rx}/operators/creation.rb +6 -6
- data/lib/{rx_ruby → rx}/operators/multiple.rb +22 -23
- data/lib/{rx_ruby → rx}/operators/single.rb +14 -14
- data/lib/{rx_ruby → rx}/operators/standard_query_operators.rb +6 -6
- data/lib/{rx_ruby → rx}/operators/synchronization.rb +8 -8
- data/lib/{rx_ruby → rx}/operators/time.rb +12 -12
- data/lib/{rx_ruby → rx}/subjects/async_subject.rb +4 -4
- data/lib/{rx_ruby → rx}/subjects/behavior_subject.rb +3 -3
- data/lib/{rx_ruby → rx}/subjects/replay_subject.rb +5 -5
- data/lib/{rx_ruby → rx}/subjects/subject.rb +4 -4
- data/lib/{rx_ruby → rx}/subjects/subject_extensions.rb +3 -3
- data/lib/{rx_ruby → rx}/subscriptions/composite_subscription.rb +1 -1
- data/lib/{rx_ruby → rx}/subscriptions/ref_count_subscription.rb +2 -2
- data/lib/{rx_ruby → rx}/subscriptions/scheduled_subscription.rb +1 -1
- data/lib/{rx_ruby → rx}/subscriptions/serial_subscription.rb +1 -1
- data/lib/{rx_ruby → rx}/subscriptions/single_assignment_subscription.rb +1 -1
- data/lib/{rx_ruby → rx}/subscriptions/subscription.rb +1 -1
- data/lib/{rx_ruby → rx}/testing/cold_observable.rb +4 -4
- data/lib/{rx_ruby → rx}/testing/hot_observable.rb +4 -4
- data/lib/{rx_ruby → rx}/testing/mock_observer.rb +4 -4
- data/lib/{rx_ruby → rx}/testing/reactive_test.rb +3 -3
- data/lib/{rx_ruby → rx}/testing/recorded.rb +1 -1
- data/lib/{rx_ruby → rx}/testing/test_scheduler.rb +8 -8
- data/lib/{rx_ruby → rx}/testing/test_subscription.rb +1 -1
- data/lib/rx/version.rb +3 -0
- data/readme.md +19 -19
- data/{rx_ruby.gemspec → rx.gemspec} +2 -2
- data/test/{rx_ruby → rx}/concurrency/helpers/historical_virtual_scheduler_helper.rb +0 -0
- data/test/{rx_ruby → rx}/concurrency/helpers/immediate_local_scheduler_helper.rb +0 -0
- data/test/{rx_ruby → rx}/concurrency/test_async_lock.rb +1 -1
- data/test/{rx_ruby → rx}/concurrency/test_current_thread_scheduler.rb +3 -3
- data/test/{rx_ruby → rx}/concurrency/test_default_scheduler.rb +1 -1
- data/test/{rx_ruby → rx}/concurrency/test_historical_scheduler.rb +3 -3
- data/test/{rx_ruby → rx}/concurrency/test_immediate_scheduler.rb +2 -2
- data/test/{rx_ruby → rx}/concurrency/test_local_scheduler.rb +2 -2
- data/test/{rx_ruby → rx}/concurrency/test_periodic_scheduler.rb +1 -1
- data/test/{rx_ruby → rx}/concurrency/test_scheduled_item.rb +4 -4
- data/test/{rx_ruby → rx}/concurrency/test_scheduler.rb +2 -2
- data/test/{rx_ruby → rx}/concurrency/test_virtual_time_scheduler.rb +2 -2
- data/test/{rx_ruby → rx}/core/test_notification.rb +20 -20
- data/test/{rx_ruby → rx}/core/test_observable_creation.rb +220 -63
- data/test/{rx_ruby → rx}/core/test_observer.rb +39 -39
- data/test/{rx_ruby → rx}/internal/test_priority_queue.rb +6 -6
- data/test/{rx_ruby → rx}/subscriptions/test_composite_subscription.rb +20 -20
- data/test/{rx_ruby → rx}/subscriptions/test_serial_subscription.rb +9 -9
- data/test/{rx_ruby → rx}/subscriptions/test_singleassignment_subscription.rb +8 -8
- data/test/{rx_ruby → rx}/subscriptions/test_subscription.rb +3 -3
- data/test/test_helper.rb +1 -1
- metadata +129 -129
- data/lib/rx_ruby/linq/observable/interval.rb +0 -5
- data/lib/rx_ruby/version.rb +0 -3
@@ -1,12 +1,12 @@
|
|
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 '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
3
|
+
require 'rx/concurrency/current_thread_scheduler'
|
4
|
+
require 'rx/concurrency/immediate_scheduler'
|
5
|
+
require 'rx/core/observer'
|
6
|
+
require 'rx/subscriptions/composite_subscription'
|
7
|
+
require 'rx/subscriptions/subscription'
|
8
8
|
|
9
|
-
module
|
9
|
+
module Rx
|
10
10
|
|
11
11
|
module Observable
|
12
12
|
|
@@ -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
3
|
require 'monitor'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
|
11
|
-
module
|
4
|
+
require 'rx/subscriptions/single_assignment_subscription'
|
5
|
+
require 'rx/subscriptions/serial_subscription'
|
6
|
+
require 'rx/subscriptions/scheduled_subscription'
|
7
|
+
require 'rx/core/observer'
|
8
|
+
require 'rx/core/observable'
|
9
|
+
require 'rx/core/observe_on_observer'
|
10
|
+
|
11
|
+
module Rx
|
12
12
|
module Observable
|
13
13
|
|
14
14
|
# Wraps the source sequence in order to run its subscription and unsubscribe logic on the specified scheduler.
|
@@ -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 '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require '
|
12
|
-
require '
|
13
|
-
|
14
|
-
|
15
|
-
module
|
4
|
+
require 'rx/concurrency/default_scheduler'
|
5
|
+
require 'rx/subscriptions/subscription'
|
6
|
+
require 'rx/subscriptions/composite_subscription'
|
7
|
+
require 'rx/subscriptions/ref_count_subscription'
|
8
|
+
require 'rx/subscriptions/serial_subscription'
|
9
|
+
require 'rx/subscriptions/single_assignment_subscription'
|
10
|
+
require 'rx/core/observer'
|
11
|
+
require 'rx/core/observable'
|
12
|
+
require 'rx/subjects/subject'
|
13
|
+
|
14
|
+
|
15
|
+
module Rx
|
16
16
|
|
17
17
|
# Time based operations
|
18
18
|
module Observable
|
@@ -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
3
|
require 'thread'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
4
|
+
require 'rx/core/observer'
|
5
|
+
require 'rx/core/observable'
|
6
|
+
require 'rx/subscriptions/subscription'
|
7
7
|
|
8
|
-
module
|
8
|
+
module Rx
|
9
9
|
|
10
10
|
# Represents the result of an asynchronous operation.
|
11
11
|
# Each notification is broadcasted to all subscribed observers.
|
@@ -1,10 +1,10 @@
|
|
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 '
|
5
|
-
require '
|
4
|
+
require 'rx/core/observer'
|
5
|
+
require 'rx/core/observable'
|
6
6
|
|
7
|
-
module
|
7
|
+
module Rx
|
8
8
|
|
9
9
|
# Represents a value that changes over time.
|
10
10
|
# Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
|
@@ -1,12 +1,12 @@
|
|
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 '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
4
|
+
require 'rx/concurrency/current_thread_scheduler'
|
5
|
+
require 'rx/core/observer'
|
6
|
+
require 'rx/core/observable'
|
7
|
+
require 'rx/core/time_interval'
|
8
8
|
|
9
|
-
module
|
9
|
+
module Rx
|
10
10
|
|
11
11
|
# Represents an object that is both an observable sequence as well as an observer.
|
12
12
|
# Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
|
@@ -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
3
|
require 'thread'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
4
|
+
require 'rx/core/observer'
|
5
|
+
require 'rx/core/observable'
|
6
|
+
require 'rx/subscriptions/subscription'
|
7
7
|
|
8
|
-
module
|
8
|
+
module Rx
|
9
9
|
|
10
10
|
# Represents an object that is both an observable sequence as well as an observer.
|
11
11
|
# Each notification is broadcasted to all subscribed observers.
|
@@ -1,9 +1,9 @@
|
|
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 '
|
4
|
-
require '
|
3
|
+
require 'rx/core/observer'
|
4
|
+
require 'rx/core/observable'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Rx
|
7
7
|
|
8
8
|
# Provides a set of static methods for creating subjects.
|
9
9
|
class Subject
|
@@ -1,9 +1,9 @@
|
|
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 '
|
4
|
+
require 'rx/subscriptions/subscription'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Rx
|
7
7
|
|
8
8
|
# Represents a subscription resource that only disposes its underlying subscription resource when all dependent subscription objects have been unsubscribed.
|
9
9
|
class RefCountSubscription
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
|
-
module
|
3
|
+
module Rx
|
4
4
|
# Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler
|
5
5
|
class ScheduledDisposable
|
6
6
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'thread'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Rx
|
6
6
|
|
7
7
|
# Represents a subscription resource whose underlying subscription resource can be replaced by another subscription resource, causing automatic disposal of the previous underlying subscription resource.
|
8
8
|
class SerialSubscription
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'thread'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Rx
|
6
6
|
|
7
7
|
# Represents a subscription resource which only allows a single assignment of its underlying subscription resource.
|
8
8
|
# If an underlying subscription resource has already been set, future attempts to set the underlying subscription resource will throw an error
|
@@ -1,10 +1,10 @@
|
|
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 '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'rx/subscriptions/subscription'
|
4
|
+
require 'rx/subscriptions/composite_subscription'
|
5
|
+
require 'rx/testing/test_subscription'
|
6
6
|
|
7
|
-
module
|
7
|
+
module Rx
|
8
8
|
|
9
9
|
class ColdObservable
|
10
10
|
|
@@ -1,10 +1,10 @@
|
|
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 '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'rx/core/observable'
|
4
|
+
require 'rx/subscriptions/subscription'
|
5
|
+
require 'rx/testing/test_subscription'
|
6
6
|
|
7
|
-
module
|
7
|
+
module Rx
|
8
8
|
|
9
9
|
class HotObservable
|
10
10
|
include Observable
|
@@ -1,10 +1,10 @@
|
|
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 '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'rx/core/observer'
|
4
|
+
require 'rx/core/notification'
|
5
|
+
require 'rx/testing/recorded'
|
6
6
|
|
7
|
-
module
|
7
|
+
module Rx
|
8
8
|
|
9
9
|
class MockObserver
|
10
10
|
include Observer
|
@@ -1,9 +1,9 @@
|
|
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 '
|
4
|
-
require '
|
3
|
+
require 'rx/core/notification'
|
4
|
+
require 'rx/testing/recorded'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Rx
|
7
7
|
|
8
8
|
# Module to write unit tests for applications and libraries built using Reactive Extensions.
|
9
9
|
module ReactiveTest
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
|
-
module
|
3
|
+
module Rx
|
4
4
|
|
5
5
|
# Record of a value including the virtual time it was produced on.
|
6
6
|
class Recorded < Struct.new(:time, :value)
|
@@ -1,13 +1,13 @@
|
|
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 '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
3
|
+
require 'rx/concurrency/virtual_time_scheduler'
|
4
|
+
require 'rx/subscriptions/subscription'
|
5
|
+
require 'rx/testing/cold_observable'
|
6
|
+
require 'rx/testing/hot_observable'
|
7
|
+
require 'rx/testing/mock_observer'
|
8
|
+
require 'rx/testing/reactive_test'
|
9
9
|
|
10
|
-
module
|
10
|
+
module Rx
|
11
11
|
|
12
12
|
# Virtual time scheduler used for testing applications and libraries built using Reactive Extensions.
|
13
13
|
class TestScheduler < VirtualTimeScheduler
|
@@ -44,7 +44,7 @@ module RxRuby
|
|
44
44
|
def configure(options = {})
|
45
45
|
options.each {|key,_|
|
46
46
|
unless [:created, :subscribed, :disposed].include? key
|
47
|
-
raise ArgumentError, "Should be
|
47
|
+
raise ArgumentError, "Should be specified whether :created, :subscribed or :disposed, but the #{key.inspect}"
|
48
48
|
end
|
49
49
|
}
|
50
50
|
o = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
|
-
module
|
3
|
+
module Rx
|
4
4
|
|
5
5
|
# Records information about subscriptions to and unsubscriptions from observable sequences.
|
6
6
|
class TestSubscription < Struct.new(:subscribe, :unsubscribe)
|
data/lib/rx/version.rb
ADDED
data/readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/ReactiveX/RxRuby.svg?branch=master)](https://travis-ci.org/ReactiveX/RxRuby)
|
2
|
-
[![GitHub version](
|
3
|
-
[![Downloads](
|
2
|
+
[![GitHub version](https://img.shields.io/github/tag/ReactiveX/RxRuby.svg)](https://github.com/ReactiveX/RxRuby)
|
3
|
+
[![Downloads](https://img.shields.io/gem/dt/rx.svg)](https://www.npmjs.com/package/rx)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/ReactiveX/RxRuby/badges/gpa.svg)](https://codeclimate.com/github/ReactiveX/RxRuby)
|
5
5
|
|
6
6
|
**[The Need to go Reactive](#the-need-to-go-reactive)** |
|
@@ -14,19 +14,19 @@
|
|
14
14
|
|
15
15
|
## The Need to go Reactive ##
|
16
16
|
|
17
|
-
Reactive Programming is a hot topic as of late, especially with such things as the [Reactive Manifesto](http://www.reactivemanifesto.org/). Applications needs have changed over time
|
17
|
+
Reactive Programming is a hot topic as of late, especially with such things as the [Reactive Manifesto](http://www.reactivemanifesto.org/). Applications' needs have changed over time, from simple polling for data to a full reactive system where data is pushed at you. Each time, we're adding more complexity, data, and asynchronous behavior to our applications. How do we manage it all? How do we scale it? By moving towards "Reactive Architectures" which are event-driven, resilient, and responsive. With the Reactive Extensions, you have all the tools you need to help build these systems.
|
18
18
|
|
19
19
|
## About the Reactive Extensions ##
|
20
20
|
|
21
|
-
The Reactive Extensions for Ruby (RxRuby) is a set of libraries for composing asynchronous and event-based programs using observable sequences and fluent query operators that many of you already know
|
21
|
+
The Reactive Extensions for Ruby (RxRuby) is a set of libraries for composing asynchronous and event-based programs using observable sequences and fluent query operators that many of you already know in Ruby. Using RxRuby, developers represent asynchronous data streams with Observables, query asynchronous data streams using our many operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, RxRuby = Observables + Operators + Schedulers.
|
22
22
|
|
23
|
-
When you're authoring applications with Ruby, there may be times when you want to deal with asynchronous
|
23
|
+
When you're authoring applications with Ruby, there may be times when you want to deal with asynchronous and event-based programming, and synchronization is difficult and error prone.
|
24
24
|
|
25
|
-
Using RxRuby, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock
|
25
|
+
Using RxRuby, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quotes, tweets, computer events, web service requests, etc.), and subscribe to the event stream using the Observer module. The Observable notifies the subscribed Observer instance whenever an event occurs.
|
26
26
|
|
27
|
-
Because observable sequences are data streams, you can query them using standard query operators implemented by the Observable module. Thus you can filter, project, reduce, compose and perform time-based operations on multiple events easily by using these
|
27
|
+
Because observable sequences are data streams, you can query them using standard query operators implemented by the Observable module. Thus you can filter, project, reduce, compose, and perform time-based operations on multiple events easily by using these operators. In addition, there are a number of other reactive stream-specific operators that allow powerful queries to be written. Cancellation, exceptions, and synchronization are also handled gracefully by using the methods on the Observable module.
|
28
28
|
|
29
|
-
But the best news of all is that you already know how to program like this. Take for example the following Ruby code, where we get some stock data
|
29
|
+
But the best news of all is that you already know how to program like this. Take for example the following Ruby code, where we get some stock data, manipulate it, and then iterate over the results.
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
# Get evens and square each
|
@@ -36,7 +36,7 @@ someSource
|
|
36
36
|
.each {|x| puts x.to_s }
|
37
37
|
```
|
38
38
|
|
39
|
-
Using RxRuby, you can accomplish the same kind of thing with a push
|
39
|
+
Using RxRuby, you can accomplish the same kind of thing with a push-based collection by changing `each` to `subscribe`.
|
40
40
|
|
41
41
|
```ruby
|
42
42
|
someSource
|
@@ -47,7 +47,7 @@ someSource
|
|
47
47
|
|
48
48
|
## Why RxRuby? ##
|
49
49
|
|
50
|
-
The overall goal of [RxRuby](https://github.com/ReactiveX/RxRuby) is to have a push
|
50
|
+
The overall goal of [RxRuby](https://github.com/ReactiveX/RxRuby) is to have a push-based version of the [Enumerable module](http://ruby-doc.org/core-2.1.0/Enumerable.html) with an added notion of time. Right now, the [Observable module](http://ruby-doc.org/stdlib-1.9.3/libdoc/observer/rdoc/Observable.html) is not quite what we want because it does not allow for composition. That is no more than a simple implementation of the Subject/Observer pattern from the Gang of Four book, such as the following.
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
require 'observer'
|
@@ -87,13 +87,13 @@ observer = ArrayObserver.new(observable)
|
|
87
87
|
# 2
|
88
88
|
```
|
89
89
|
|
90
|
-
But
|
90
|
+
But how do you enable better composition so that you can compose together Observable instances? In this current model, this can't happen. That's why we need the Reactive Extensions for Ruby. Not only that, we can, at any point in the computation, change the concurrency model to be immediate, on a new thread, or on another machine.
|
91
91
|
|
92
|
-
There are many implementations of the Reactive Extensions such as [RxJS](https://github.com/Reactive-Extensions/RxJS), [Rx.NET](https://github.com/reactive-extensions/rx.net), [Java/JVM/Clojure/Scala/JRuby/Groovy](https://github.com/
|
92
|
+
There are many implementations of the Reactive Extensions such as [RxJS](https://github.com/Reactive-Extensions/RxJS), [Rx.NET](https://github.com/reactive-extensions/rx.net), [Java/JVM/Clojure/Scala/JRuby/Groovy](https://github.com/ReactiveX/RxJava) and [ObjC/ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa). Our goal is to have one operate like the JRuby one, but be available to all users of Ruby, regardless of VM.
|
93
93
|
|
94
|
-
We'd like it to be
|
94
|
+
We'd like it to be like our JavaScript version, [RxJS](https://github.com/Reactive-Extensions/RxJS) but be able to handle multi-threading, parallelism, and in addition, go across the network.
|
95
95
|
|
96
|
-
Instead, our goal is to make the Observable module look exactly like the Enumerable module in that you can write any query method over it to produce a value, but have it push
|
96
|
+
Instead, our goal is to make the Observable module look exactly like the Enumerable module, in that you can write any query method over it to produce a value, but have it push-based. This could become yet another competitor to [EventMachine](http://rubyeventmachine.com/), in which we have rich composition over events, whether locally or across the network.
|
97
97
|
|
98
98
|
So, take an example, zipping two Arrays.
|
99
99
|
|
@@ -109,10 +109,10 @@ a.zip([1, 2], [8]) #=> [[4, 1, 8], [5, 2, nil], [6, nil, nil]]
|
|
109
109
|
Now, we could do something similar in [RxRuby](https://github.com/ReactiveX/RxRuby) with two observable sequences:
|
110
110
|
|
111
111
|
```ruby
|
112
|
-
require '
|
112
|
+
require 'rx'
|
113
113
|
|
114
|
-
a =
|
115
|
-
b =
|
114
|
+
a = Rx::Observable.from_array [ 4, 5, 6 ]
|
115
|
+
b = Rx::Observable.from_array [ 7, 8, 9 ]
|
116
116
|
|
117
117
|
sub = a.zip(b).subscribe {|arr| puts arr.to_s }
|
118
118
|
# => "[4, 7]"
|
@@ -123,9 +123,9 @@ sub = a.zip(b).subscribe {|arr| puts arr.to_s }
|
|
123
123
|
sub.unsubscribe
|
124
124
|
```
|
125
125
|
|
126
|
-
The difference here is that `zip` returns an `
|
126
|
+
The difference here is that `zip` returns an `Rx::Observable` instead of an `Enumerable`. And once you call `subscribe` it's much like `each` but takes an observer, or perhaps just some blocks, lambdas, etc. The subscription handed back contains the cancellation logic. For example, if you are listening to events and you no longer want to listen, you can call `unsubscribe` on the `sub` variable above.
|
127
127
|
|
128
|
-
What's the end goal? The first part is
|
128
|
+
What's the end goal? The first part is that we want to support the main `Enumerable` module methods in the `Observable` module and have them react the same way, but push instead of pull-based. From there, we can explore such things as multi-threading, and calls across the network.
|
129
129
|
|
130
130
|
If you want to find out more, please check out the JavaScript version, [RxJS](https://github.com/Reactive-Extensions/RxJS), which has more details on the overall goals.
|
131
131
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'rx/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.authors = ["Microsoft Open Technologies, Inc."]
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = "rx"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version =
|
16
|
+
gem.version = Rx::VERSION
|
17
17
|
gem.license = 'Apache License, v2.0'
|
18
18
|
|
19
19
|
gem.add_development_dependency 'rake'
|
File without changes
|
File without changes
|