Class: What::Modules::Existence

Inherits:
Base
  • Object
show all
Defined in:
lib/what/modules/existence.rb

Constant Summary collapse

DEFAULTS =
{
  'paths' => []
}

Instance Attribute Summary

Attributes inherited from Base

#interval

Instance Method Summary collapse

Methods inherited from Base

#identifier, #initialize, #name, #shared_status, #start_monitoring, #status

Constructor Details

This class inherits a constructor from What::Modules::Base

Instance Method Details

#checkObject



11
12
13
14
15
16
17
18
19
# File 'lib/what/modules/existence.rb', line 11

def check
  @config['paths'].each do |path|
    if Dir[path].count == 0
      @paths[path] = false
    else
      @paths[path] = true
    end
  end
end

#detailsObject



25
26
27
# File 'lib/what/modules/existence.rb', line 25

def details
  @paths
end

#healthObject



21
22
23
# File 'lib/what/modules/existence.rb', line 21

def health
  Helpers.overall_health(@paths.map { |k, v| v ? 'ok' : 'alert' })
end

#initialize_moduleObject



7
8
9
# File 'lib/what/modules/existence.rb', line 7

def initialize_module
  @paths = {}
end