Class: ReverseProxy::Config::Generic

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/reverse_proxy/config/generic.rb

Direct Known Subclasses

Nginx

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#log

Constructor Details

#initialize(proxy) ⇒ Generic

Returns a new instance of Generic.



6
7
8
9
10
# File 'lib/reverse_proxy/config/generic.rb', line 6

def initialize proxy
  @proxy = proxy
  proxy.config = self
  @written = false
end

Instance Attribute Details

#proxyObject (readonly)

Returns the value of attribute proxy.



5
6
7
# File 'lib/reverse_proxy/config/generic.rb', line 5

def proxy
  @proxy
end

Instance Method Details

#prepare(type) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/reverse_proxy/config/generic.rb', line 11

def prepare type
  return unless block_given?
  result = yield
  name   = result.to_s.strip
  mkdir name if type.to_s =~ /^dir/
  touch name if type.to_s =~ /^file/
  result
end