Sha256: caa78d11d1c3332b5aad2f33dbee4b2ee4aa903d0fd5aca79c916d89d79a8fdc

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

class Plugin
  @@list = []
  def self.load(dir)
    Dir::glob("#{dir}/*.rb").each do |fname|
      open(fname) do |src|
        begin
          val = instance_eval(src.read.untaint, fname, 1)
          @@list << val if val
          warn("loaded plugin: #{fname}")
        rescue
          warn($!)
        end
      end
    end
  end

  attr_reader :api
  def initialize(args)
    @api = []
    @@list.each do |klass|
      begin
        @api += klass.new(*args).api
      rescue
        warn($!)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gnn-rblibs-0.0.4 lib/plugin.rb
gnn-rblibs-0.0.3 lib/plugin.rb
gnn-rblibs-0.0.1 lib/plugin.rb