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.
40 41 42 43 44 45 46 47 |
# File 'lib/haproxy/config.rb', line 40 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.
38 39 40 |
# File 'lib/haproxy/config.rb', line 38 def backends @backends end |
#defaults ⇒ Object
Returns the value of attribute defaults.
38 39 40 |
# File 'lib/haproxy/config.rb', line 38 def defaults @defaults end |
#frontends ⇒ Object
Returns the value of attribute frontends.
38 39 40 |
# File 'lib/haproxy/config.rb', line 38 def frontends @frontends end |
#global ⇒ Object
Returns the value of attribute global.
38 39 40 |
# File 'lib/haproxy/config.rb', line 38 def global @global end |
#listeners ⇒ Object
Returns the value of attribute listeners.
38 39 40 |
# File 'lib/haproxy/config.rb', line 38 def listeners @listeners end |
#original_parse_tree ⇒ Object
Returns the value of attribute original_parse_tree.
38 39 40 |
# File 'lib/haproxy/config.rb', line 38 def original_parse_tree @original_parse_tree end |
Class Method Details
.parse_file(filename) ⇒ Object
73 74 75 |
# File 'lib/haproxy/config.rb', line 73 def parse_file(filename) HAProxy::Parser.new.parse_file(filename) end |
Instance Method Details
#backend(name) ⇒ Object
53 54 55 |
# File 'lib/haproxy/config.rb', line 53 def backend(name) backends.find { |b| b.name == name } end |
#default(name = nil) ⇒ Object
61 62 63 |
# File 'lib/haproxy/config.rb', line 61 def default(name = nil) defaults.find { |d| d.name == name } end |
#frontend(name) ⇒ Object
57 58 59 |
# File 'lib/haproxy/config.rb', line 57 def frontend(name) frontends.find { |f| f.name == name } end |
#listener(name) ⇒ Object
49 50 51 |
# File 'lib/haproxy/config.rb', line 49 def listener(name) listeners.find { |l| l.name == name } end |
#render ⇒ Object
65 66 67 68 |
# File 'lib/haproxy/config.rb', line 65 def render renderer = HAProxy::Renderer.new(self, original_parse_tree) renderer.render end |