Module: RiderServer::Utils
- Defined in:
- lib/rider_server/utils.rb
Defined Under Namespace
Classes: FixedArray
Class Method Summary collapse
-
.create_listeners(address, port) ⇒ Object
Creates TCP server sockets bound to
address
:port
and returns them. - .rider_display(obj) ⇒ Object
Class Method Details
.create_listeners(address, port) ⇒ Object
Creates TCP server sockets bound to address
:port
and returns them.
It will create IPV4 and IPV6 sockets on all interfaces.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rider_server/utils.rb', line 19 def create_listeners(address, port) unless port raise ArgumentError, "must specify port" end sockets = Socket.tcp_server_sockets(address, port) sockets.map { |s| s.autoclose = false ts = TCPServer.for_fd(s.fileno) s.close ts } end |
.rider_display(obj) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/rider_server/utils.rb', line 33 def rider_display(obj) if obj.respond_to?(:rider_display) obj.rider_display else obj.inspect end end |