Skip to content

Commit ddc0d0e

Browse files
author
Bjorn Ramberg
committed
Rename ScheduledDisposable -> ScheduledSubscription
Observable#subscribe_on incorrectly referred to the latter, but the class was actually called the former. Looking at similar implementation it seems to me to be more in line with a subscription than a disposable.
1 parent fb1c5cf commit ddc0d0e

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

lib/rx/subscriptions/scheduled_subscription.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
22

33
module Rx
4-
# Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler
5-
class ScheduledDisposable
4+
# Represents a subscription that is unsubscribed on the specified scheduler
5+
class ScheduledSubscription
66

77
attr_reader :scheduler, :subscription
88

@@ -21,12 +21,12 @@ def unsubscribed?
2121

2222
# Unsubscribes the wrapped subscription on the provided scheduler.
2323
def unsubscribe
24-
@scheduler.schedule lambda do
24+
@scheduler.schedule lambda {
2525
unless @subscription.nil?
2626
@subscription.unsubscribe
2727
@subscription = nil
2828
end
29-
end
29+
}
3030
end
3131
end
3232
end
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2+
3+
require "#{File.dirname(__FILE__)}/../../test_helper"
4+
5+
class TestObservableSynchronization < Minitest::Test
6+
include Rx::ReactiveTest
7+
8+
def test_subscribe_on_default_scheduler_does_not_raise
9+
Rx::Observable.just(1).subscribe_on(Rx::DefaultScheduler.instance).subscribe
10+
end
11+
12+
def test_subscribe_on_current_thread_scheduiler_does_not_raise
13+
Rx::Observable.just(1).subscribe_on(Rx::CurrentThreadScheduler.instance).subscribe
14+
end
15+
end

0 commit comments

Comments
 (0)