Class: ValidationRage::UdpNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- ValidationRage::UdpNotifier
- Defined in:
- lib/validation_rage/udp_notifier.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#socket ⇒ Object
Returns the value of attribute socket.
Instance Method Summary collapse
- #call(event_name, payload) ⇒ Object
-
#initialize(args) ⇒ UdpNotifier
constructor
A new instance of UdpNotifier.
Methods inherited from BaseNotifier
Constructor Details
#initialize(args) ⇒ UdpNotifier
Returns a new instance of UdpNotifier.
6 7 8 9 10 |
# File 'lib/validation_rage/udp_notifier.rb', line 6 def initialize(args) self.socket = UDPSocket.new self.host = args[:host] self.port = args[:port] end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/validation_rage/udp_notifier.rb', line 5 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/validation_rage/udp_notifier.rb', line 5 def port @port end |
#socket ⇒ Object
Returns the value of attribute socket.
5 6 7 |
# File 'lib/validation_rage/udp_notifier.rb', line 5 def socket @socket end |
Instance Method Details
#call(event_name, payload) ⇒ Object
12 13 14 |
# File 'lib/validation_rage/udp_notifier.rb', line 12 def call(event_name, payload) self.socket.send(payload.to_json, 0, self.host, self.port) end |