Class: RDaux::Web::Server
- Inherits:
-
Object
- Object
- RDaux::Web::Server
- Includes:
- Notifier
- Defined in:
- lib/rdaux/web/server.rb
Instance Method Summary collapse
-
#initialize(app, logger, static_dir, options) ⇒ Server
constructor
A new instance of Server.
- #serve(website) ⇒ Object
Methods included from Notifier
#add_listener, #broadcast, #notifier_initialize
Constructor Details
#initialize(app, logger, static_dir, options) ⇒ Server
Returns a new instance of Server.
10 11 12 13 14 15 16 17 |
# File 'lib/rdaux/web/server.rb', line 10 def initialize(app, logger, static_dir, ) @app = app @logger = logger @static_dir = static_dir @options = notifier_initialize end |
Instance Method Details
#serve(website) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rdaux/web/server.rb', line 19 def serve(website) with_duplicate_static_dir do |dir| @app.configure do @app.set(:site, website) @app.set(:public_folder, dir) end Unicorn::HttpServer.new(@app, { :listeners => @options.fetch(:bind, 'localhost:8080'), :worker_processes => @options.fetch(:workers, 4), :logger => @logger }).start.join end end |