Class: Capistrano::Role
- Inherits:
-
Object
show all
- Includes:
- Enumerable
- Defined in:
- lib/capistrano/role.rb
Defined Under Namespace
Classes: DynamicServerList
Instance Method Summary
collapse
Constructor Details
#initialize(*list) ⇒ Role
Returns a new instance of Role.
5
6
7
8
9
|
# File 'lib/capistrano/role.rb', line 5
def initialize(*list)
@static_servers = []
@dynamic_servers = []
push(*list)
end
|
Instance Method Details
#clear ⇒ Object
36
37
38
39
|
# File 'lib/capistrano/role.rb', line 36
def clear
@dynamic_servers.clear
@static_servers.clear
end
|
#each(&block) ⇒ Object
11
12
13
|
# File 'lib/capistrano/role.rb', line 11
def each(&block)
servers.each &block
end
|
#empty? ⇒ Boolean
32
33
34
|
# File 'lib/capistrano/role.rb', line 32
def empty?
servers.empty?
end
|
#include?(server) ⇒ Boolean
41
42
43
|
# File 'lib/capistrano/role.rb', line 41
def include?(server)
servers.include?(server)
end
|
#push(*list) ⇒ Object
Also known as:
<<
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/capistrano/role.rb', line 15
def push(*list)
options = list.last.is_a?(Hash) ? list.pop : {}
list.each do |item|
if item.respond_to?(:call)
@dynamic_servers << DynamicServerList.new(item, options)
else
@static_servers << self.class.wrap_server(item, options)
end
end
end
|
#servers ⇒ Object
Also known as:
to_ary
27
28
29
|
# File 'lib/capistrano/role.rb', line 27
def servers
@static_servers + dynamic_servers
end
|