Class: WFA::Heartbeat

Inherits:
Object
  • Object
show all
Defined in:
lib/wfa/heartbeat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nodesObject (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_atObject (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_addrObject (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_sObject



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