Class: HaproxyParser::Builders::ServerParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line:, backend_name:) ⇒ ServerParser

Returns a new instance of ServerParser.



8
9
10
11
# File 'lib/haproxy_parser/builders/server_parser.rb', line 8

def initialize(line:, backend_name:)
  @line = line
  @backend_name = backend_name
end

Instance Attribute Details

#backend_nameObject (readonly)

Returns the value of attribute backend_name.



7
8
9
# File 'lib/haproxy_parser/builders/server_parser.rb', line 7

def backend_name
  @backend_name
end

#lineObject (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

#ipaddressObject



17
18
19
# File 'lib/haproxy_parser/builders/server_parser.rb', line 17

def ipaddress
  @ipaddress ||= line[1].split(":")[0]
end

#nameObject



13
14
15
# File 'lib/haproxy_parser/builders/server_parser.rb', line 13

def name
  @name ||= line[0]
end

#portObject



21
22
23
# File 'lib/haproxy_parser/builders/server_parser.rb', line 21

def port
  @port ||= line[1].split(":")[1]
end