1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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