Class: Capistrano::Doctor::ServersDoctor::RoleWhitespaceChecker
- Inherits:
-
Object
- Object
- Capistrano::Doctor::ServersDoctor::RoleWhitespaceChecker
- Defined in:
- lib/capistrano/doctor/servers_doctor.rb
Instance Attribute Summary collapse
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
-
#whitespace_roles ⇒ Object
readonly
Returns the value of attribute whitespace_roles.
Instance Method Summary collapse
- #any_has_whitespace?(roles) ⇒ Boolean
- #include_whitespace?(role) ⇒ Boolean
-
#initialize(servers) ⇒ RoleWhitespaceChecker
constructor
A new instance of RoleWhitespaceChecker.
- #whitespace_roles_decorated ⇒ Object
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
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
37 38 39 |
# File 'lib/capistrano/doctor/servers_doctor.rb', line 37 def servers @servers end |
#whitespace_roles ⇒ Object (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
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
48 49 50 |
# File 'lib/capistrano/doctor/servers_doctor.rb', line 48 def include_whitespace?(role) role =~ /\s/ end |
#whitespace_roles_decorated ⇒ Object
52 53 54 |
# File 'lib/capistrano/doctor/servers_doctor.rb', line 52 def whitespace_roles_decorated whitespace_roles.map(&:inspect).join(", ") end |