Class: Krakow::Command::Pub
- Inherits:
-
Krakow::Command
- Object
- Krakow::Command
- Krakow::Command::Pub
- Defined in:
- lib/krakow/command/pub.rb
Overview
Publish single message
Instance Attribute Summary
Attributes inherited from Krakow::Command
Attributes collapse
-
#message ⇒ Object
The message attribute.
-
#message? ⇒ TrueClass, FalseClass
Truthiness of the message attribute.
-
#topic_name ⇒ String
The topic_name attribute.
-
#topic_name? ⇒ TrueClass, FalseClass
Truthiness of the topic_name attribute.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Krakow::Command
#error?, #name, #ok?, response_for
Methods included from Utils::Lazy
Methods included from Utils::Logging
Class Method Details
.error ⇒ Object
30 31 32 |
# File 'lib/krakow/command/pub.rb', line 30 def error %w(E_INVALID E_BAD_TOPIC E_BAD_MESSAGE E_PUB_FAILED) end |
.ok ⇒ Object
26 27 28 |
# File 'lib/krakow/command/pub.rb', line 26 def ok %w(OK) end |
Instance Method Details
#message ⇒ Object
Returns the message attribute.
16 |
# File 'lib/krakow/command/pub.rb', line 16 attribute :message, Object, :required => true |
#message? ⇒ TrueClass, FalseClass
Returns truthiness of the message attribute.
16 |
# File 'lib/krakow/command/pub.rb', line 16 attribute :message, Object, :required => true |
#to_line ⇒ Object
20 21 22 23 |
# File 'lib/krakow/command/pub.rb', line 20 def to_line msg = .to_s [name, ' ', topic_name, "\n", msg.bytesize, msg].pack('a*a*a*a*l>a*') end |
#topic_name ⇒ String
Returns the topic_name attribute.
15 |
# File 'lib/krakow/command/pub.rb', line 15 attribute :topic_name, String, :required => true |
#topic_name? ⇒ TrueClass, FalseClass
Returns truthiness of the topic_name attribute.
15 |
# File 'lib/krakow/command/pub.rb', line 15 attribute :topic_name, String, :required => true |