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



85
86
87
88
# File 'lib/deputy.rb', line 85

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



74
75
76
77
78
79
80
81
82
83
# File 'lib/deputy.rb', line 74

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