Class: WFA::Heartbeat
- Inherits:
-
Object
- Object
- WFA::Heartbeat
- Defined in:
- lib/wfa/heartbeat.rb
Instance Attribute Summary collapse
-
#active_nodes ⇒ Object
readonly
Returns the value of attribute active_nodes.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#ip_addr ⇒ Object
readonly
Returns the value of attribute ip_addr.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Heartbeat
constructor
A new instance of Heartbeat.
- #to_s ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Heartbeat
Returns a new instance of Heartbeat.
5 6 7 8 9 |
# File 'lib/wfa/heartbeat.rb', line 5 def initialize attrs @ip_addr = attrs[:ip_addr] @active_nodes = attrs[:active_nodes] @created_at = Time.parse(attrs[:created_at]) end |
Instance Attribute Details
#active_nodes ⇒ Object (readonly)
Returns the value of attribute active_nodes.
4 5 6 |
# File 'lib/wfa/heartbeat.rb', line 4 def active_nodes @active_nodes end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/wfa/heartbeat.rb', line 4 def created_at @created_at end |
#ip_addr ⇒ Object (readonly)
Returns the value of attribute ip_addr.
4 5 6 |
# File 'lib/wfa/heartbeat.rb', line 4 def ip_addr @ip_addr end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/wfa/heartbeat.rb', line 11 def to_s "%s: %d active nodes [%s]" % [ created_at.strftime("%F %T"), active_nodes, ip_addr ] end |