Implementation

Class: Subscription.

Constants

PUBLISHABLE, private

A Set containing publishable type identifiers.

SUBSCRIBABLE, private

A Set containing subscribable type identifiers.

Attributes

Methods

Subscription.subscribable()

def Subscription.subscribable()
return SUBSCRIBABLE
end

Gets SUBSCRIBABLE. Returns SUBSCRIBABLE's reference.

Subscription.publishable()

def Subscription.publishable()
return PUBLISHABLE
end

Gets PUBLISHABLE. Returns PUBLISHABLE's reference.

Subscription.s_instance(subscriber = nil)

def Subscription.s_instance(subscriber = nil)
subscriber_c = subscriber.class()
return (subscribable().include?(subscriber_c))
end

Predicate. Verifies an object is a subscribable type's instance. Takes a subscribable instance argument, subscriber. In the case subscriber is a subscribable type's instance, returns true. Returns false otherwise.

Subscription.publisher(published = nil)

def Subscription.publisher(published = nil)
p_class = published.class()
return (publishable().include?(p_class))
end

Predicate. Verifies a publishable argument is a publishing type instance. Takes a publishable type instance argument, published. Returns true in the case published's class is a publishable class. Returns false otherwise.

Subscription.update(subject = nil)

def Subscription.update(subject = nil)
k_s_i = kind_subscription(subject)
kind_singleton = k_s_i.instance()
kind_singleton.update_subscribers(subject)
return nil
end

Updates an Observer subject's subscribers. Takes a subscribable argument, subject. Updates all subject's feed subscribers. Returns nil.

Subscription.kind_subscription(publisher = nil) private

def Subscription.kind_subscription(published = nil)
unless (publisher(published))
raise(ArgumentError, "#{published} is not a subscribable instance.")
else
case
when published.instance_of?(Node)
return NodeSubscription
end
end
end

Discerns the appropriate subscription identifier. Takes a publishable argument, publisher. Returns publisher's kind subscription identifier. Raises an ArgumentError in the case the argument is not a publishable object.

Subscription.new() private, undefined