Class: Lifter::Server
- Inherits:
-
Object
- Object
- Lifter::Server
- Defined in:
- lib/lifter/server.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#file_manager ⇒ Object
readonly
Returns the value of attribute file_manager.
Instance Method Summary collapse
-
#initialize(&config) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(&config) ⇒ Server
Returns a new instance of Server.
7 8 9 10 |
# File 'lib/lifter/server.rb', line 7 def initialize(&config) @config = Config.new(&config) @file_manager = FileManager.new(@config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/lifter/server.rb', line 5 def config @config end |
#file_manager ⇒ Object (readonly)
Returns the value of attribute file_manager.
5 6 7 |
# File 'lib/lifter/server.rb', line 5 def file_manager @file_manager end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lifter/server.rb', line 12 def start EventMachine.epoll if EventMachine.epoll? EventMachine.kqueue if EventMachine.kqueue? EventMachine.run do host = @config.get(:host) port = @config.get(:port) EventMachine.start_server(host, port, Connection) do |connection| connection.server = self end end end |