Class: Watobo::PassiveModules

Inherits:
Object
  • Object
show all
Defined in:
lib/watobo/core/passive_checks.rb

Overview

:nodoc: all

Class Method Summary collapse

Class Method Details

.each(&block) ⇒ Object



6
7
8
9
10
11
# File 'lib/watobo/core/passive_checks.rb', line 6

def self.each(&block)
  if block_given?
    @checks.map{|c| yield c }
  end
  
end

.initObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/watobo/core/passive_checks.rb', line 21

def self.init
  passive_modules = []

  Dir["#{Watobo.passive_module_path}/*.rb"].each do |mod_file|
    begin
      mod = File.basename(mod_file)

      load mod_file
    rescue => bang
      puts "!!!"
      puts bang
    end
  end

  Watobo::Modules::Passive.constants.each do |m|
    begin
      class_constant = Watobo::Modules::Passive.const_get(m)
      pc = class_constant.new(self)
      print "."
      @checks << pc

    rescue => bang
      puts "!!!"
      puts bang
    end
  end
  
  passive_modules
end

.lengthObject



17
18
19
# File 'lib/watobo/core/passive_checks.rb', line 17

def self.length
  @checks.length  
end

.to_aObject



13
14
15
# File 'lib/watobo/core/passive_checks.rb', line 13

def self.to_a
  @checks
end