Class: Xap::XapHeartbeat
- Inherits:
-
XapMessage
- Object
- XapMessage
- Xap::XapHeartbeat
- Defined in:
- lib/xap/xap_msg.rb
Overview
An xAP heartbeat message.
Instance Attribute Summary collapse
-
#interval ⇒ Object
Returns the value of attribute interval.
Attributes inherited from XapMessage
#headername, #hop, #msgclass, #src_addr, #target_addr, #uid, #version
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(src_addr, src_uid, interval = 60) ⇒ XapHeartbeat
constructor
A new instance of XapHeartbeat.
Methods inherited from XapMessage
register_class, #to_s, #uid_endpoint
Constructor Details
#initialize(src_addr, src_uid, interval = 60) ⇒ XapHeartbeat
Returns a new instance of XapHeartbeat.
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/xap/xap_msg.rb', line 182 def initialize src_addr, src_uid, interval = 60 @headername = 'xap-hbeat' if src_addr.is_a?(Hash) parse_header src_addr[@headername] interval = src_addr[@headername]['interval'] || interval else super 'xap-hbeat.alive', src_addr, src_uid end add_header 'interval', interval @interval = interval end |
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval.
176 177 178 |
# File 'lib/xap/xap_msg.rb', line 176 def interval @interval end |
Class Method Details
.parse(hash) ⇒ Object
178 179 180 |
# File 'lib/xap/xap_msg.rb', line 178 def self.parse hash self.new hash, nil end |