-
-
Save jredville/8743749 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | |
module RX | |
# Records information about subscriptions to and unsubscriptions from observable sequences. | |
class TestSubscription < Struct.new(:subscribe, :unsubscribe) | |
FIXNUM_MAX = (2**(0.size * 8 -2) -1) | |
def initialize(subscribe, unsubscribe = FIXNUM_MAX) | |
super | |
end | |
def ==(o) | |
o.class == self.class && subscribe == other.subscribe && unsubscribe == other.unsubscribe | |
end | |
alias_method :eql?, :== | |
def inifinite? | |
unsubscribe == FIXNUM_MAX | |
end | |
def to_s | |
"#{subscribe}, #{infinite? ? 'Infinite' : unsubscribe}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment