Class: Nginx::Server

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

Overview

The server_name line of a server block.

Direct Known Subclasses

RailsServer, StaticServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain: nil) ⇒ Server

Returns a new instance of Server.



7
8
9
# File 'lib/shared_infrastructure/nginx/server.rb', line 7

def initialize(domain: nil)
  @domain = domain
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



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

def domain
  @domain
end

Instance Method Details

#root_directoryObject



13
14
15
# File 'lib/shared_infrastructure/nginx/server.rb', line 13

def root_directory
  domain.site_root
end

#to_s(level = 0) ⇒ Object



17
18
19
# File 'lib/shared_infrastructure/nginx/server.rb', line 17

def to_s(level = 0)
  Lines.new("server_name #{domain.certbot_domain_names};").format(level)
end