Class: Capistrano::Doctor::ServersDoctor::RoleWhitespaceChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/doctor/servers_doctor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(servers) ⇒ RoleWhitespaceChecker

Returns a new instance of RoleWhitespaceChecker.



39
40
41
42
# File 'lib/capistrano/doctor/servers_doctor.rb', line 39

def initialize(servers)
  @servers = servers
  @whitespace_roles = find_whitespace_roles
end

Instance Attribute Details

#serversObject (readonly)

Returns the value of attribute servers.



37
38
39
# File 'lib/capistrano/doctor/servers_doctor.rb', line 37

def servers
  @servers
end

#whitespace_rolesObject (readonly)

Returns the value of attribute whitespace_roles.



37
38
39
# File 'lib/capistrano/doctor/servers_doctor.rb', line 37

def whitespace_roles
  @whitespace_roles
end

Instance Method Details

#any_has_whitespace?(roles) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/capistrano/doctor/servers_doctor.rb', line 44

def any_has_whitespace?(roles)
  roles.any? { |role| include_whitespace?(role) }
end

#include_whitespace?(role) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/capistrano/doctor/servers_doctor.rb', line 48

def include_whitespace?(role)
  role =~ /\s/
end

#whitespace_roles_decoratedObject



52
53
54
# File 'lib/capistrano/doctor/servers_doctor.rb', line 52

def whitespace_roles_decorated
  whitespace_roles.map(&:inspect).join(", ")
end