Class: Scout

Inherits:
Object
  • Object
show all
Defined in:
lib/deputy.rb

Defined Under Namespace

Classes: Plugin

Class Method Summary collapse

Class Method Details

.plugin_in_container(container) ⇒ Object



81
82
83
84
# File 'lib/deputy.rb', line 81

def self.plugin_in_container(container)
  constants = container.constants.map{|constant_name|container.const_get(constant_name)}
  constants.detect{|c| c.instance_methods.map{|m| m.to_s}.include?('build_report') }
end

.plugins(code) ⇒ Object



70
71
72
73
74
75
76
77
78
79
# File 'lib/deputy.rb', line 70

def self.plugins(code)
  eval_and_fetch_constants(code).map do |container|
    interval = container.interval
    unless plugin = plugin_in_container(container)
      Deputy.send_report "Deputies.Plugin not found", code
      next
    end
    [interval, plugin]
  end.compact
end