-
-
Save jredville/8793614 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 | |
module Notification | |
class << self | |
def create_on_next(value) | |
OnNextNotification.new value | |
end | |
def create_on_error(error) | |
# TODO | |
end | |
def create_on_completed | |
# TODO | |
end | |
end | |
end | |
# Represents an on_next notification to an observer. | |
class OnNextNotification | |
# this may not be needed, this doesn't create the create_on_* | |
# methods on OnNextNotification. If you want that, then you should | |
# use a included hook, or make those methods normal module methods and | |
# extend instead of include | |
include Notification | |
attr_reader :value, :kind | |
def initialize(value) | |
@value = value | |
@kind = :on_next | |
end | |
def has_value? | |
true | |
end | |
def ==(other) | |
o.class == self.class && @kind == other.kind && @value == other.value | |
end | |
alias_method :eql?, :== | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment