Class: Watobo::ActiveModules
- Inherits:
-
Object
- Object
- Watobo::ActiveModules
- Defined in:
- lib/watobo/core/active_checks.rb
Overview
:nodoc: all
Class Method Summary collapse
Class Method Details
.each(&block) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/watobo/core/active_checks.rb', line 5 def self.each(&block) if block_given? @checks.map{|c| yield c } end end |
.init ⇒ Object
20 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/active_checks.rb', line 20 def self.init @checks = [] active_path = Watobo.active_module_path Dir["#{active_path}/**"].each do |group| if File.ftype(group) == "directory" Dir["#{group}/*.rb"].each do |mod_file| begin # module_file = File.join(active_path, group, modules) mod = File.basename(mod_file) group_name = File.basename(group)# notify(:logger, LOG_DEBUG, "loading module: #{module_file}") require mod_file group_class = group_name.slice(0..0).upcase + group_name.slice(1..-1).downcase # module_class = mod.slice(0..0).upcase + mod.slice(1..-1).downcase module_class.sub!(".rb","") ac = Watobo::Modules::Active.const_get(group_class).const_get(module_class) print "." @checks << ac rescue => bang puts bang end end end end @checks end |
.length ⇒ Object
16 17 18 |
# File 'lib/watobo/core/active_checks.rb', line 16 def self.length @checks.length end |
.to_a ⇒ Object
12 13 14 |
# File 'lib/watobo/core/active_checks.rb', line 12 def self.to_a @checks end |