Class: Oxy::Server
- Inherits:
-
Object
- Object
- Oxy::Server
- Defined in:
- lib/oxy/server.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#status ⇒ Object
Returns the value of attribute status.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(argv = [], stdin = $stdin, stdout = $stdout, stderr = $stderr) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
Constructor Details
#initialize(argv = [], stdin = $stdin, stdout = $stdout, stderr = $stderr) ⇒ Server
Returns a new instance of Server.
13 14 15 16 17 18 19 |
# File 'lib/oxy/server.rb', line 13 def initialize(argv = [], stdin = $stdin, stdout = $stdout, stderr = $stderr) @stdout = stdout @options = OpenStruct.new @parser = option_parser # actually parse arguments input (argv) end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/oxy/server.rb', line 9 def @options end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/oxy/server.rb', line 9 def status @status end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
11 12 13 |
# File 'lib/oxy/server.rb', line 11 def stdout @stdout end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/oxy/server.rb', line 21 def run # setup oxy's folder FileUtils.mkdir_p(oxy_home_path) unless File.exist?(oxy_home_path) # process user's options (if any) miscellaneous # start server's thread server_thread = start_server # wait for the server's thread to join server_thread.join if server_thread end |