Class: SimplePublisher::Publisher
- Inherits:
-
Object
- Object
- SimplePublisher::Publisher
- Defined in:
- lib/simple_publisher/publisher.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Publisher
constructor
A new instance of Publisher.
- #publish(raw_message) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Publisher
Returns a new instance of Publisher.
5 6 7 8 9 10 11 12 13 |
# File 'lib/simple_publisher/publisher.rb', line 5 def initialize(attributes = {}) unless attributes.keys.include?(:topic) and attributes.keys.include?(:connection) raise ArgumentError, "You must specify a connection and a topic" end attributes.each do |attr, value| send("#{attr}=", value) end end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
3 4 5 |
# File 'lib/simple_publisher/publisher.rb', line 3 def connection @connection end |
#topic ⇒ Object
Returns the value of attribute topic.
3 4 5 |
# File 'lib/simple_publisher/publisher.rb', line 3 def topic @topic end |