Class: ConfCtl::HealthChecks::RunCommand::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/confctl/health_checks/run_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#excludeArray<String> (readonly)

Returns:

  • (Array<String>)


13
14
15
# File 'lib/confctl/health_checks/run_command.rb', line 13

def exclude
  @exclude
end

#includeArray<String> (readonly)

Returns:

  • (Array<String>)


10
11
12
# File 'lib/confctl/health_checks/run_command.rb', line 10

def include
  @include
end

#matchString? (readonly)

Returns:

  • (String, nil)


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

Returns:

  • (String, nil)


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

Returns:

  • (String, nil)


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

Returns:

  • (String, nil)


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