Class: What::Modules::Existence
- Defined in:
- lib/what/modules/existence.rb
Constant Summary collapse
- DEFAULTS =
{ 'paths' => [] }
Instance Method Summary collapse
- #check! ⇒ Object
- #details ⇒ Object
- #health ⇒ Object
-
#initialize ⇒ Existence
constructor
A new instance of Existence.
Methods inherited from Base
Constructor Details
#initialize ⇒ Existence
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 |
#details ⇒ Object
26 27 28 |
# File 'lib/what/modules/existence.rb', line 26 def details @paths end |
#health ⇒ Object
22 23 24 |
# File 'lib/what/modules/existence.rb', line 22 def health Helpers.overall_health(@paths.map { |k, v| v ? 'ok' : 'alert' }) end |