Class: Healthety::Transmission
- Inherits:
-
Object
- Object
- Healthety::Transmission
- Defined in:
- lib/healthety/transmission.rb
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Transmission
constructor
A new instance of Transmission.
- #send(name, value) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ Transmission
Returns a new instance of Transmission.
6 7 8 9 10 11 |
# File 'lib/healthety/transmission.rb', line 6 def initialize(host, port) @host = host @port = port @worker_host = Socket.gethostname @socket = UDPSocket.new end |
Instance Method Details
#send(name, value) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/healthety/transmission.rb', line 13 def send(name, value) data = { :value => value, :name => name, :date => Time.now.to_f, :host => @worker_host }.to_json @socket.send(data, 0, @host, @port) $stdout << "#{name}: #{value}\n" end |