Class: Smartware::PubSubClient::Message
- Inherits:
-
Object
- Object
- Smartware::PubSubClient::Message
- Defined in:
- lib/smartware/pub_sub_client.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #acknowlege ⇒ Object
- #id ⇒ Object
-
#initialize(reliable_id, key, args, callback) ⇒ Message
constructor
A new instance of Message.
- #reliable? ⇒ Boolean
- #to_a ⇒ Object
Constructor Details
#initialize(reliable_id, key, args, callback) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 |
# File 'lib/smartware/pub_sub_client.rb', line 8 def initialize(reliable_id, key, args, callback) @reliable_id = reliable_id @key = key @args = args @callback = callback end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/smartware/pub_sub_client.rb', line 6 def args @args end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/smartware/pub_sub_client.rb', line 6 def key @key end |
Instance Method Details
#[](index) ⇒ Object
29 30 31 |
# File 'lib/smartware/pub_sub_client.rb', line 29 def [](index) @args[index] end |
#acknowlege ⇒ Object
23 24 25 26 27 |
# File 'lib/smartware/pub_sub_client.rb', line 23 def acknowlege raise "message is not reliable" if @reliable_id.nil? @callback.call @reliable_id end |
#id ⇒ Object
19 20 21 |
# File 'lib/smartware/pub_sub_client.rb', line 19 def id @reliable_id end |
#reliable? ⇒ Boolean
15 16 17 |
# File 'lib/smartware/pub_sub_client.rb', line 15 def reliable? !@reliable_id.nil? end |
#to_a ⇒ Object
33 34 35 |
# File 'lib/smartware/pub_sub_client.rb', line 33 def to_a @args end |