Module: Ipecache::Plugins

Defined in:
lib/ipecache/plugins.rb,
lib/ipecache/plugins/local.rb,
lib/ipecache/plugins/akamai.rb,
lib/ipecache/plugins/fastly.rb,
lib/ipecache/plugins/maxcdn.rb,
lib/ipecache/plugins/plugin.rb,
lib/ipecache/plugins/varnish.rb,
lib/ipecache/plugins/ats_chef.rb,
lib/ipecache/plugins/edgecast.rb,
lib/ipecache/plugins/cloudflare.rb,
lib/ipecache/plugins/cloudfront.rb,
lib/ipecache/plugins/swisstxt_cdn.rb

Defined Under Namespace

Classes: AKAMAI, ATSChef, CloudFlare, CloudFront, Edgecast, Fastly, Local, MaxCDN, Plugin, SwisstxtCdn, Varnish

Class Method Summary collapse

Class Method Details

.klassesObject

Get and return a list of all subclasses (plugins) that are not the base plugin



16
17
18
19
20
# File 'lib/ipecache/plugins.rb', line 16

def self.klasses
  @@klasses ||= self.constants.collect do |c|
    self.const_get(c) if self.const_get(c).is_a?(Class) && self.const_get(c) != Ipecache::Plugins::Plugin
  end.compact
end

.run(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/ipecache/plugins.rb', line 6

def self.run(options = {})
  hook = options[:hook].to_sym

  klasses.each do |klass|
    plugin = klass.new(options)
    plugin.send(hook) if plugin.respond_to?(hook) && plugin.enabled?
  end
end