Class: Rig::Template::Balancer
- Inherits:
-
Object
- Object
- Rig::Template::Balancer
- Defined in:
- lib/rig/template.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primary(enable = nil) ⇒ Object
readonly
Returns the value of attribute primary.
-
#sticky(type = nil, expires_or_cookie = nil) ⇒ Object
readonly
Returns the value of attribute sticky.
-
#sticky_arg ⇒ Object
readonly
Returns the value of attribute sticky_arg.
-
#sticky_type ⇒ Object
readonly
Returns the value of attribute sticky_type.
Instance Method Summary collapse
-
#initialize(name) ⇒ Balancer
constructor
A new instance of Balancer.
- #listener(&block) ⇒ Object
- #listeners ⇒ Object
Constructor Details
#initialize(name) ⇒ Balancer
Returns a new instance of Balancer.
162 163 164 165 166 167 |
# File 'lib/rig/template.rb', line 162 def initialize(name) @listeners = [] @name = name.to_sym @primary = false @sticky = false end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
160 161 162 |
# File 'lib/rig/template.rb', line 160 def name @name end |
#primary(enable = nil) ⇒ Object (readonly)
Returns the value of attribute primary.
160 161 162 |
# File 'lib/rig/template.rb', line 160 def primary @primary end |
#sticky(type = nil, expires_or_cookie = nil) ⇒ Object (readonly)
Returns the value of attribute sticky.
160 161 162 |
# File 'lib/rig/template.rb', line 160 def sticky @sticky end |
#sticky_arg ⇒ Object (readonly)
Returns the value of attribute sticky_arg.
160 161 162 |
# File 'lib/rig/template.rb', line 160 def sticky_arg @sticky_arg end |
#sticky_type ⇒ Object (readonly)
Returns the value of attribute sticky_type.
160 161 162 |
# File 'lib/rig/template.rb', line 160 def sticky_type @sticky_type end |
Instance Method Details
#listener(&block) ⇒ Object
173 174 175 176 177 |
# File 'lib/rig/template.rb', line 173 def listener(&block) listener = Listener.new listener.instance_eval &block @listeners << listener end |
#listeners ⇒ Object
179 180 181 |
# File 'lib/rig/template.rb', line 179 def listeners @listeners.map { |e| e.spec } end |