Class: Rig::Template::Balancer

Inherits:
Object
  • Object
show all
Defined in:
lib/rig/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



157
158
159
# File 'lib/rig/template.rb', line 157

def name
  @name
end

#sticky_argObject (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_typeObject (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

#listenersObject



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, expires_or_cookie)
  @sticky_type = type
  @sticky_arg = expires_or_cookie
end