Class: What::Modules::Existence

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

Constant Summary collapse

DEFAULTS =
{
  'paths' => []
}

Instance Method Summary collapse

Methods inherited from Base

#name, #status

Constructor Details

#initializeExistence

Returns a new instance of Existence.



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

def initialize
  super
  @paths = {}
end

Instance Method Details

#check!Object



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

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

#detailsObject



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

def details
  @paths
end

#healthObject



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

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