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.
-
#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
- #primary(enable = nil) ⇒ Object
- #sticky(type, expires_or_cookie) ⇒ Object
Constructor Details
#initialize(name) ⇒ Balancer
159 160 161 162 163 |
# File 'lib/rig/template.rb', line 159 def initialize(name) @listeners = [] @name = name.to_sym @primary = false end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
157 158 159 |
# File 'lib/rig/template.rb', line 157 def name @name end |
#sticky_arg ⇒ Object (readonly)
Returns the value of attribute sticky_arg.
157 158 159 |
# File 'lib/rig/template.rb', line 157 def sticky_arg @sticky_arg end |
#sticky_type ⇒ Object (readonly)
Returns the value of attribute sticky_type.
157 158 159 |
# File 'lib/rig/template.rb', line 157 def sticky_type @sticky_type end |
Instance Method Details
#listener(&block) ⇒ Object
169 170 171 172 173 |
# File 'lib/rig/template.rb', line 169 def listener(&block) listener = Listener.new listener.instance_eval &block @listeners << listener end |
#listeners ⇒ Object
175 176 177 |
# File 'lib/rig/template.rb', line 175 def listeners @listeners.map { |e| e.spec } end |
#primary(enable = nil) ⇒ Object
165 166 167 |
# File 'lib/rig/template.rb', line 165 def primary(enable = nil) enable.nil? ? @primary : @primary = enable end |
#sticky(type, expires_or_cookie) ⇒ Object
179 180 181 182 |
# File 'lib/rig/template.rb', line 179 def sticky(type, ) @sticky_type = type @sticky_arg = end |