Class: RevealCK::Commands::StartWebServer

Inherits:
Object
  • Object
show all
Defined in:
lib/reveal-ck/commands/start_web_server.rb

Overview

The idea of starting up a webserver to display slides locally.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc_root, port, host) ⇒ StartWebServer

Returns a new instance of StartWebServer.



10
11
12
13
14
# File 'lib/reveal-ck/commands/start_web_server.rb', line 10

def initialize(doc_root, port, host)
  @doc_root = doc_root
  @port = port
  @host = host
end

Instance Attribute Details

#doc_rootObject (readonly)

Returns the value of attribute doc_root.



9
10
11
# File 'lib/reveal-ck/commands/start_web_server.rb', line 9

def doc_root
  @doc_root
end

#hostObject (readonly)

Returns the value of attribute host.



9
10
11
# File 'lib/reveal-ck/commands/start_web_server.rb', line 9

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/reveal-ck/commands/start_web_server.rb', line 9

def port
  @port
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
# File 'lib/reveal-ck/commands/start_web_server.rb', line 16

def run
  Rack::Server.new(app: build_rack_app(doc_root),
                   Host: host,
                   Port: port,
                   Logger: server_log,
                   DoNotReverseLookup: true,
                   AccessLog: access_log).start
end