Top Level Namespace

Defined Under Namespace

Classes: Compiler

Instance Method Summary collapse

Instance Method Details

#nginx_conf(&block) ⇒ Object



8
9
10
11
12
# File 'lib/nginx-conf/nginx_conf.rb', line 8

def nginx_conf &block
  repeats = %i(server load_module fastcgi_param set if_)
  Compiler.new(replace_elems repeats)
      .compile replace_elems(block_is_hash(repeats, &block))
end

#replace_elems(object) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/nginx-conf/nginx_conf.rb', line 15

def replace_elems object
  map = { if_: :if, return_: :return }
  map_rec object do |x|
    if map.keys.include? x
      map[x]
    else
      x
    end
  end
end