Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created January 31, 2014 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattpodwysocki/8743690 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/8743690 to your computer and use it in GitHub Desktop.
# 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
FIXNUM_MAX = (2**(0.size * 8 -2) -1)
attr_reader :subscribe, :unsubscribe
def initialize(subscribe, unsubscribe = FIXNUM_MAX)
@subscribe = subscribe
@unsubscribe = unsubscribe
end
def ==(o)
o.class == self.class && @subscribe == other.subscribe && @unsubscribe == other.unsubscribe
end
alias_method :eql?, :==
def to_s
return @unsubscribe == FIXNUM_MAX ?
'#{@subscribe}, Infinite' :
'#{@subscribe}, #{@unsubscribe}'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment