Class: Surak::Server
- Inherits:
-
Object
- Object
- Surak::Server
- Defined in:
- lib/surak.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(serving_directory_path: "./dist", mounting_point: "/", port: 8080) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(serving_directory_path: "./dist", mounting_point: "/", port: 8080) ⇒ Server
Returns a new instance of Server.
26 27 28 29 30 |
# File 'lib/surak.rb', line 26 def initialize(serving_directory_path: "./dist", mounting_point: "/", port: 8080) self.server = WEBrick::HTTPServer.new :Port => port server.mount mounting_point, NonCachingFileHandler , serving_directory_path trap('INT') { server.stop } end |
Instance Attribute Details
#server ⇒ Object
Returns the value of attribute server.
25 26 27 |
# File 'lib/surak.rb', line 25 def server @server end |
Instance Method Details
#start ⇒ Object
32 33 34 |
# File 'lib/surak.rb', line 32 def start self.server.start end |