Class: HaproxyParser::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/haproxy_parser/config.rb

Constant Summary collapse

SECTIONS =
%w(global defaults frontend backend)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



10
11
12
# File 'lib/haproxy_parser/config.rb', line 10

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/haproxy_parser/config.rb', line 9

def path
  @path
end

#serversObject (readonly)

Returns the value of attribute servers.



9
10
11
# File 'lib/haproxy_parser/config.rb', line 9

def servers
  @servers
end

Instance Method Details

#backendsObject



34
35
36
# File 'lib/haproxy_parser/config.rb', line 34

def backends
  @backends ||= []
end

#check_format!Object



14
15
16
17
18
# File 'lib/haproxy_parser/config.rb', line 14

def check_format!
  HaproxyParser::FormatChecker.new(
    path
  ).run
end

#frontendsObject



30
31
32
# File 'lib/haproxy_parser/config.rb', line 30

def frontends
  @frontends ||= []
end

#globalObject



26
27
28
# File 'lib/haproxy_parser/config.rb', line 26

def global
  @global ||= build_global
end

#parseObject



20
21
22
23
24
# File 'lib/haproxy_parser/config.rb', line 20

def parse
  check_format!
  build
  self
end