Class: Wsv::Server::Banner

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

Overview

Renders the startup announcement (the “Serving / Bind / Local / Stop” block plus warnings about non-loopback binds and self-signed certs).

Instance Method Summary collapse

Constructor Details

#initialize(host:, port:, root:, out:, err:, tls:) ⇒ Banner

Returns a new instance of Banner.



8
9
10
11
12
13
14
15
# File 'lib/wsv/server/banner.rb', line 8

def initialize(host:, port:, root:, out:, err:, tls:)
  @host = host
  @port = port
  @root = root
  @out = out
  @err = err
  @tls = tls
end

Instance Method Details

#emitObject



17
18
19
20
21
22
23
24
# File 'lib/wsv/server/banner.rb', line 17

def emit
  @out.puts "Serving: #{@root}"
  @out.puts "Bind:    #{url_for(@host)}"
  @out.puts "Local:   #{url_for('127.0.0.1')}" unless localhost?(@host)
  @out.puts "Stop:    Ctrl-C"
  warn_public_bind unless localhost?(@host)
  warn_ephemeral_cert if @tls&.ephemeral?
end