Class: Juggernaut::Message
- Inherits:
-
Object
- Object
- Juggernaut::Message
- Defined in:
- lib/juggernaut/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
-
#initialize(id, body, signature, utime = nil) ⇒ Message
constructor
A new instance of Message.
- #timestamp ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, body, signature, utime = nil) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 14 |
# File 'lib/juggernaut/message.rb', line 8 def initialize(id, body, signature, utime = nil) @id = id @body = body @signature = signature @created_at = Time.now = utime end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/juggernaut/message.rb', line 5 def body @body end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/juggernaut/message.rb', line 6 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/juggernaut/message.rb', line 3 def id @id end |
#signature ⇒ Object
Returns the value of attribute signature.
4 5 6 |
# File 'lib/juggernaut/message.rb', line 4 def signature @signature end |
Instance Method Details
#timestamp ⇒ Object
16 17 18 |
# File 'lib/juggernaut/message.rb', line 16 def || @created_at.to_f.to_s end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/juggernaut/message.rb', line 20 def to_s { :id => @id.to_s, :body => @body, :signature => @signature, :timestamp => .to_s }.to_json end |