Class: Staccato::Adapter::UDP
- Inherits:
-
Object
- Object
- Staccato::Adapter::UDP
- Defined in:
- lib/staccato/adapter/udp.rb
Instance Method Summary collapse
-
#initialize(uri) ⇒ UDP
constructor
Takes a URI with host/port e.g.: URI(‘udp://127.0.0.1:3001’).
- #post(params) ⇒ Object
Constructor Details
#initialize(uri) ⇒ UDP
Takes a URI with host/port
e.g.: URI('udp://127.0.0.1:3001')
9 10 11 12 13 14 |
# File 'lib/staccato/adapter/udp.rb', line 9 def initialize(uri) @host = uri.host @port = uri.port @socket = UDPSocket.new end |
Instance Method Details
#post(params) ⇒ Object
16 17 18 19 20 |
# File 'lib/staccato/adapter/udp.rb', line 16 def post(params) body = URI.encode_www_form(params) @socket.send(body, 0, @host, @port) end |