Libraries
Search…
Implementation
Class: Subscription.

Constants

PUBLISHABLE, private

A Set containing publishable type identifiers.

SUBSCRIBABLE, private

A Set containing subscribable type identifiers.

Attributes

Methods

Subscription.subscribable()

1
def Subscription.subscribable()
2
return SUBSCRIBABLE
3
end
Copied!
Gets SUBSCRIBABLE. Returns SUBSCRIBABLE's reference.

Subscription.publishable()

1
def Subscription.publishable()
2
return PUBLISHABLE
3
end
Copied!
Gets PUBLISHABLE. Returns PUBLISHABLE's reference.

Subscription.s_instance(subscriber = nil)

1
def Subscription.s_instance(subscriber = nil)
2
subscriber_c = subscriber.class()
3
return (subscribable().include?(subscriber_c))
4
end
Copied!
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)

1
def Subscription.publisher(published = nil)
2
p_class = published.class()
3
return (publishable().include?(p_class))
4
end
Copied!
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)

1
def Subscription.update(subject = nil)
2
3
k_s_i = kind_subscription(subject)
4
kind_singleton = k_s_i.instance()
5
kind_singleton.update_subscribers(subject)
6
return nil
7
8
end
Copied!
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

1
def Subscription.kind_subscription(published = nil)
2
3
unless (publisher(published))
4
raise(ArgumentError, "#{published} is not a subscribable instance.")
5
else
6
case
7
when published.instance_of?(Node)
8
return NodeSubscription
9
end
10
end
11
12
end
Copied!
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

Last modified 1yr ago