Class: OrigenSim::Heartbeat

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(socket) ⇒ Heartbeat

Returns a new instance of Heartbeat.



6
7
8
9
10
11
12
13
14
15
# File 'lib/origen_sim/heartbeat.rb', line 6

def initialize(socket)
  @socket = socket
  @continue = true
  super do
    while @continue
      socket.write("OK\n")
      sleep 5
    end
  end
end

Instance Attribute Details

#socketObject (readonly)

Returns the value of attribute socket.



4
5
6
# File 'lib/origen_sim/heartbeat.rb', line 4

def socket
  @socket
end

Instance Method Details

#stopObject



17
18
19
# File 'lib/origen_sim/heartbeat.rb', line 17

def stop
  @continue = false
end