A NodeSubscription library interface. Class: NodeSubscriptionInt.



instance, undeclared

A singleton instance.

feeds, undeclared

All subscription feeds. Its elements are Hashes. The keys are Node references, and their values are Sets containing corresponding subscribers.

Method Signatures


def NodeSubscriptionInt.instance()

Lazily initializes a singleton instance, or gets the singleton instance. Returns the NodeSubscription singleton instance.

publisher(p = nil)

def publisher(p = nil)

Predicate. Verifies a Node is a feed publisher. Takes a publishable object argument, p. Returns true in the case p is a feeds key. false otherwise.

update_subscribers(publisher = nil)

def update_subscribers(publisher = nil)

Updates a publisher's subscribers. Takes a changed Node publisher argument, publisher. Updates publisher's subscribers. In the case publisher is not a feeds key, raises an ArgumentError. Returns nil.

add_publisher(p = nil)

def add_publisher(p = nil)

Adds a Node publisher. Takes a Node argument, p. Creates a subscription feed. The feed's key is p, and the feed Set is empty.

add_subscriber(p = nil, s = nil)

def add_subscriber(p = nil, s = nil)

Adds a subscriber a feed. Takes a Node argument, p, and a subscribable instance, s. Adds the subscriber, s, the publisher p's feed. In the case p is not a feed publisher, or s is not a subscribable object, raises an ArgumentError.

feeds() protected

def feeds()

Gets feeds. Returns the Set reference.

feed(p = nil) protected

def feed(p = nil)

Gets a publisher's feed. Takes a Node argument, p. Finds the publisher p's feed, and returns its Set reference. In the case p is not a feeds element Hash key, raises an ArgumentError.

feeds=(s = Set[]) private

def feeds=(s = Set[])

Sets feeds. The parameter s defaults an empty Set. feeds calls once, in the singleton instance's initialization, and sets feeds the empty Set.

kind_factory(s = nil) private

def kind_factory(s = nil)

Gets a subscriber's factory identifier. Takes an argument subscriber, s. Discerns s's factory identifier, and returns the identifier.

initialize() private

def initialize()

Initializes the singleton instance.

NodeSubscriptionInt.instance=(s = nil) private

def NodeSubscriptionInt.instance=(s = nil)

Sets the singleton instance. Takes a NodeSubscription instance argument, s. Sets instance the instance. Returns the argument NodeSubscription. private, undeclared