logstash/lib/net/messages/ping.rb
Jordan Sissel 434a633013 - hashbind is back! Dynamically generate methods that we would normally
hand-code. This method is as fast as the hand-coded method and with less
  writing.
- Make message registration easier with a simple 'register' function:
  class Foo < Message
    register
  end

  We dynamically generate the message 'type' by the class name.
2009-09-10 09:59:24 +00:00

24 lines
487 B
Ruby

require "lib/net/message"
module LogStash; module Net; module Messages
class PingRequest < RequestMessage
register
def initialize
super
self.pingdata = Time.now.to_f
end
# Message attributes
hashbind :pingdata, "/args/pingdata"
end # class PingRequest
class PingResponse < ResponseMessage
register
# Message attributes
hashbind :pingdata, "/args/pingdata"
end # class PingResponse
end; end; end # module LogStash::Net::Messages