Class: ConfCtl::HealthChecks::RunCommand::Output
- Inherits:
-
Object
- Object
- ConfCtl::HealthChecks::RunCommand::Output
- Defined in:
- lib/confctl/health_checks/run_command.rb
Instance Attribute Summary collapse
- #exclude ⇒ Array<String> readonly
- #include ⇒ Array<String> readonly
- #match ⇒ String? readonly
Instance Method Summary collapse
-
#check_exclude(str) ⇒ String?
Returns the string that is and should not be included.
-
#check_include(str) ⇒ String?
Returns the string that should be and is not included.
-
#check_match(str) ⇒ String?
Returns nil if there is a match.
-
#initialize(opts) ⇒ Output
constructor
A new instance of Output.
Constructor Details
#initialize(opts) ⇒ Output
Returns a new instance of Output.
15 16 17 18 19 |
# File 'lib/confctl/health_checks/run_command.rb', line 15 def initialize(opts) @match = opts['match'] @include = opts['include'] @exclude = opts['exclude'] end |
Instance Attribute Details
#exclude ⇒ Array<String> (readonly)
13 14 15 |
# File 'lib/confctl/health_checks/run_command.rb', line 13 def exclude @exclude end |
#include ⇒ Array<String> (readonly)
10 11 12 |
# File 'lib/confctl/health_checks/run_command.rb', line 10 def include @include end |
#match ⇒ String? (readonly)
7 8 9 |
# File 'lib/confctl/health_checks/run_command.rb', line 7 def match @match end |
Instance Method Details
#check_exclude(str) ⇒ String?
Returns the string that is and should not be included
43 44 45 46 47 48 49 |
# File 'lib/confctl/health_checks/run_command.rb', line 43 def check_exclude(str) @exclude.each do |exc| return exc if str.include?(exc) end nil end |
#check_include(str) ⇒ String?
Returns the string that should be and is not included
33 34 35 36 37 38 39 |
# File 'lib/confctl/health_checks/run_command.rb', line 33 def check_include(str) @include.each do |inc| return inc unless str.include?(inc) end nil end |
#check_match(str) ⇒ String?
Returns nil if there is a match
23 24 25 26 27 28 29 |
# File 'lib/confctl/health_checks/run_command.rb', line 23 def check_match(str) if @match.nil? || str == @match nil else @match end end |