Class: HaproxyParser::Builders::ServerParser
- Inherits:
-
Object
- Object
- HaproxyParser::Builders::ServerParser
- Defined in:
- lib/haproxy_parser/builders/server_parser.rb
Instance Attribute Summary collapse
-
#frontend_port ⇒ Object
readonly
Returns the value of attribute frontend_port.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
-
#initialize(line:, frontend_port:) ⇒ ServerParser
constructor
A new instance of ServerParser.
- #ipaddress ⇒ Object
- #name ⇒ Object
- #port ⇒ Object
Constructor Details
#initialize(line:, frontend_port:) ⇒ ServerParser
Returns a new instance of ServerParser.
8 9 10 11 |
# File 'lib/haproxy_parser/builders/server_parser.rb', line 8 def initialize(line:, frontend_port:) @line = line @frontend_port = frontend_port end |
Instance Attribute Details
#frontend_port ⇒ Object (readonly)
Returns the value of attribute frontend_port.
7 8 9 |
# File 'lib/haproxy_parser/builders/server_parser.rb', line 7 def frontend_port @frontend_port end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
7 8 9 |
# File 'lib/haproxy_parser/builders/server_parser.rb', line 7 def line @line end |
Instance Method Details
#ipaddress ⇒ Object
17 18 19 |
# File 'lib/haproxy_parser/builders/server_parser.rb', line 17 def ipaddress @ipaddress ||= line[1].split(":")[0] end |
#name ⇒ Object
13 14 15 |
# File 'lib/haproxy_parser/builders/server_parser.rb', line 13 def name @name ||= line[0] end |
#port ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/haproxy_parser/builders/server_parser.rb', line 21 def port @port ||= if line[1].split(":")[1] line[1].split(":")[1] else frontend_port end end |