From d3316d0b042ffa550ff56ed4e691c80003dd1414 Mon Sep 17 00:00:00 2001 From: mms Date: Fri, 27 Dec 2024 00:16:14 +0100 Subject: feat(new): server mode --- new/lib/crys/server.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 new/lib/crys/server.rb (limited to 'new/lib/crys/server.rb') diff --git a/new/lib/crys/server.rb b/new/lib/crys/server.rb new file mode 100644 index 0000000..aa0c19c --- /dev/null +++ b/new/lib/crys/server.rb @@ -0,0 +1,21 @@ +require 'webrick' +module Crys + class Server + def initialize(root:) + @root = root + end + + def start + server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => root + trap 'INT' do server.shutdown end + + server.start + end + + private + + attr_reader :root + + end +end + -- cgit v1.2.3