Class: HaproxyParser::Builders::Backend
- Defined in:
- lib/haproxy_parser/builders/backend.rb
Instance Attribute Summary collapse
-
#frontend ⇒ Object
Returns the value of attribute frontend.
Attributes inherited from Base
Instance Method Summary collapse
- #balance ⇒ Object
-
#initialize(section:, default: nil, frontend:) ⇒ Backend
constructor
A new instance of Backend.
- #mode ⇒ Object
- #servers ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(section:, default: nil, frontend:) ⇒ Backend
Returns a new instance of Backend.
8 9 10 11 |
# File 'lib/haproxy_parser/builders/backend.rb', line 8 def initialize(section:, default: nil, frontend:) super(section: section, default: default) @frontend = frontend end |
Instance Attribute Details
#frontend ⇒ Object
Returns the value of attribute frontend.
7 8 9 |
# File 'lib/haproxy_parser/builders/backend.rb', line 7 def frontend @frontend end |
Instance Method Details
#balance ⇒ Object
17 18 19 |
# File 'lib/haproxy_parser/builders/backend.rb', line 17 def balance @balance ||= dig_data("balance") end |
#mode ⇒ Object
13 14 15 |
# File 'lib/haproxy_parser/builders/backend.rb', line 13 def mode @mode ||= dig_data("mode") end |
#servers ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/haproxy_parser/builders/backend.rb', line 21 def servers @servers ||= [].tap do |arr| if line_servers[0].is_a?(Array) line_servers.each do |line_server| arr << ServerParser.new( line: line_server, frontend_port: frontend.port ) end else arr << ServerParser.new( line: line_servers, frontend_port: frontend.port ) end end end |