Class: HAProxyCluster::StatsContainer
- Inherits:
-
Object
- Object
- HAProxyCluster::StatsContainer
- Defined in:
- lib/haproxy_cluster/stats_container.rb
Instance Attribute Summary collapse
-
#stats ⇒ Object
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize(stats = {}) ⇒ StatsContainer
constructor
A new instance of StatsContainer.
- #method_missing(m, *args, &block) ⇒ Object
- #monitor(field) ⇒ Object
Constructor Details
#initialize(stats = {}) ⇒ StatsContainer
Returns a new instance of StatsContainer.
8 9 10 11 |
# File 'lib/haproxy_cluster/stats_container.rb', line 8 def initialize(stats = {}) @stats = stats @monitor_fields = [:status] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/haproxy_cluster/stats_container.rb', line 31 def method_missing(m, *args, &block) if @stats.has_key? m @stats[m] else super end end |
Instance Attribute Details
#stats ⇒ Object
Returns the value of attribute stats.
13 14 15 |
# File 'lib/haproxy_cluster/stats_container.rb', line 13 def stats @stats end |
Instance Method Details
#monitor(field) ⇒ Object
15 16 17 |
# File 'lib/haproxy_cluster/stats_container.rb', line 15 def monitor(field) @monitor_fields << field.to_sym end |