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

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

#nameObject (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_argObject (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_typeObject (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

#listenersObject



179
180
181
# File 'lib/rig/template.rb', line 179

def listeners
  @listeners.map { |e| e.spec }
end