Class: HAProxy::Config
- Inherits:
-
Object
- Object
- HAProxy::Config
- Defined in:
- lib/haproxy/config.rb
Overview
Represents an haproxy configuration file.
Instance Attribute Summary collapse
-
#backends ⇒ Object
Returns the value of attribute backends.
-
#defaults ⇒ Object
Returns the value of attribute defaults.
-
#frontends ⇒ Object
Returns the value of attribute frontends.
-
#global ⇒ Object
Returns the value of attribute global.
-
#listeners ⇒ Object
Returns the value of attribute listeners.
-
#original_parse_tree ⇒ Object
Returns the value of attribute original_parse_tree.
Class Method Summary collapse
Instance Method Summary collapse
- #backend(name) ⇒ Object
- #default(name = nil) ⇒ Object
- #frontend(name) ⇒ Object
-
#initialize(parse_tree) ⇒ Config
constructor
A new instance of Config.
- #listener(name) ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(parse_tree) ⇒ Config
Returns a new instance of Config.
39 40 41 42 43 44 45 46 |
# File 'lib/haproxy/config.rb', line 39 def initialize(parse_tree) self.original_parse_tree = parse_tree self.backends = [] self.listeners = [] self.frontends = [] self.defaults = [] self.global = {} end |
Instance Attribute Details
#backends ⇒ Object
Returns the value of attribute backends.
37 38 39 |
# File 'lib/haproxy/config.rb', line 37 def backends @backends end |
#defaults ⇒ Object
Returns the value of attribute defaults.
37 38 39 |
# File 'lib/haproxy/config.rb', line 37 def defaults @defaults end |
#frontends ⇒ Object
Returns the value of attribute frontends.
37 38 39 |
# File 'lib/haproxy/config.rb', line 37 def frontends @frontends end |
#global ⇒ Object
Returns the value of attribute global.
37 38 39 |
# File 'lib/haproxy/config.rb', line 37 def global @global end |
#listeners ⇒ Object
Returns the value of attribute listeners.
37 38 39 |
# File 'lib/haproxy/config.rb', line 37 def listeners @listeners end |
#original_parse_tree ⇒ Object
Returns the value of attribute original_parse_tree.
37 38 39 |
# File 'lib/haproxy/config.rb', line 37 def original_parse_tree @original_parse_tree end |
Class Method Details
.parse_file(filename) ⇒ Object
72 73 74 |
# File 'lib/haproxy/config.rb', line 72 def parse_file(filename) HAProxy::Parser.new.parse_file(filename) end |
Instance Method Details
#backend(name) ⇒ Object
52 53 54 |
# File 'lib/haproxy/config.rb', line 52 def backend(name) self.backends.find { |b| b.name == name } end |
#default(name = nil) ⇒ Object
60 61 62 |
# File 'lib/haproxy/config.rb', line 60 def default(name=nil) self.defaults.find { |d| d.name == name } end |
#frontend(name) ⇒ Object
56 57 58 |
# File 'lib/haproxy/config.rb', line 56 def frontend(name) self.frontends.find { |f| f.name == name } end |
#listener(name) ⇒ Object
48 49 50 |
# File 'lib/haproxy/config.rb', line 48 def listener(name) self.listeners.find { |l| l.name == name } end |
#render ⇒ Object
64 65 66 67 |
# File 'lib/haproxy/config.rb', line 64 def render renderer = HAProxy::Renderer.new(self, self.original_parse_tree) renderer.render end |