Module: Ruflet
- Defined in:
- lib/ruflet/server.rb,
lib/ruflet_server.rb,
lib/ruflet/version.rb,
lib/ruflet/server/wire_codec.rb,
lib/ruflet/server/web_socket_connection.rb
Defined Under Namespace
Classes: Server, WebSocketConnection, WireCodec
Constant Summary collapse
- VERSION =
"0.0.18"
Class Method Summary collapse
Class Method Details
.run(entrypoint = nil, host: "0.0.0.0", port: nil, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ruflet_server.rb', line 9 def run(entrypoint = nil, host: "0.0.0.0", port: nil, &block) callback = entrypoint || block raise ArgumentError, "Ruflet.run requires a callable entrypoint or block" unless callback.respond_to?(:call) port = resolved_run_port(port) if respond_to?(:resolved_run_port) port = 8550 if port.nil? Server.new(host: host, port: port) do |page| callback.call(page) end.start end |