Class: Qup::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/qup/publisher.rb

Overview

Public: A Publisher produces messages on a Topic

Example:

pub = topic.publisher
pub.publish( my_message )

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic) ⇒ Publisher

Public: Create a new Publisher for a Topic

Returns a Publisher



17
18
19
# File 'lib/qup/publisher.rb', line 17

def initialize( topic )
  @topic = topic
end

Instance Attribute Details

#topicObject (readonly)

Public: The Topic this Publisher publishes to.



12
13
14
# File 'lib/qup/publisher.rb', line 12

def topic
  @topic
end

Instance Method Details

#publish(message) ⇒ Object

Public: Publish a Message to all the Subscribers

message - the Object to send to all Subscribers.

Returns nothing



26
27
28
# File 'lib/qup/publisher.rb', line 26

def publish( message )
  @topic.publish( message )
end