Class: Oxy::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/oxy/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
  parse_options(argv)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



9
10
11
# File 'lib/oxy/server.rb', line 9

def options
  @options
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/oxy/server.rb', line 9

def status
  @status
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



11
12
13
# File 'lib/oxy/server.rb', line 11

def stdout
  @stdout
end

Instance Method Details

#runObject



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