Class: HaproxyParser::LineParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list) ⇒ LineParser

Returns a new instance of LineParser.



4
5
6
# File 'lib/haproxy_parser/line_parser.rb', line 4

def initialize(list)
  @list = list
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



3
4
5
# File 'lib/haproxy_parser/line_parser.rb', line 3

def list
  @list
end

Instance Method Details

#value(attr) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/haproxy_parser/line_parser.rb', line 8

def value(attr)
  nil.tap do |ret|
    list.each_with_index do |v, i|
      ret = list[i+1] if attr == v
    end
    break ret
  end
end