Class: Nginx::Config

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

Instance Method Summary collapse

Constructor Details

#initialize(dsl) ⇒ Config

Returns a new instance of Config.



14
15
16
17
# File 'lib/nginx/server.rb', line 14

def initialize dsl
  @maps = {}
  instance_exec &dsl
end

Instance Method Details

#host(host) ⇒ Object



27
28
29
# File 'lib/nginx/server.rb', line 27

def host host
  @host = host
end

#map(matcher, app) ⇒ Object



35
36
37
# File 'lib/nginx/server.rb', line 35

def map matcher, app
  @maps[matcher] = app
end

#port(port) ⇒ Object



31
32
33
# File 'lib/nginx/server.rb', line 31

def port port
  @port = port
end

#to_hashObject



19
20
21
22
23
24
25
# File 'lib/nginx/server.rb', line 19

def to_hash
  {
    host: @host,
    port: @port,
    maps: @maps,
  }
end