Class: Archival::HelperServer
- Inherits:
-
Object
- Object
- Archival::HelperServer
- Defined in:
- lib/archival/helper_server.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(port, build_dir) ⇒ HelperServer
constructor
A new instance of HelperServer.
- #refresh_client ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(port, build_dir) ⇒ HelperServer
Returns a new instance of HelperServer.
10 11 12 13 14 15 |
# File 'lib/archival/helper_server.rb', line 10 def initialize(port, build_dir) @port = port @build_dir = build_dir @helper_dir = File.(File.join(File.dirname(__FILE__), '../../helper')) end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
8 9 10 |
# File 'lib/archival/helper_server.rb', line 8 def page @page end |
Instance Method Details
#refresh_client ⇒ Object
38 39 40 |
# File 'lib/archival/helper_server.rb', line 38 def refresh_client ('refresh') end |
#start ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/archival/helper_server.rb', line 17 def start server = TCPServer.new @port loop do Thread.start(server.accept) do |client| req = '' method = nil path = nil while (line = client.gets) && (line != "\r\n") unless method req_info = line.split method = req_info[0] path = req_info[1] end req += line end client.close unless req handle_request(client, req, method, path) end end end |