Sha256: 52f94355f2e7c2685be13aabe1b51bc655ae59a75f4164bfef11b3020f8f11f2
Contents?: true
Size: 872 Bytes
Versions: 5
Compression:
Stored size: 872 Bytes
Contents
# encoding: utf-8 module Daiku class Plugins def self.find_plugins Daiku::Plugins.constants.map do |plugin| Daiku::Plugins.const_get(plugin.to_s, false) end end def self.register_plugins Hash[*find_plugins.map do |plugin| [plugin.meta[:name], plugin.meta] end.flatten] end def self.has_plugins?(type) register_plugins.values.any? do |plugin| plugin[:type] == type end end def self.filter_plugins(value, filter = :type) register_plugins.values.select do |plugin| plugin[filter] == value end end def self.plugin_names(type = nil) plugins = if type.nil? register_plugins.values else filter_plugins(type, :type) end plugins.map { |plugin| plugin[:name] } end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
daiku-0.2.2 | lib/daiku/plugins.rb |
daiku-0.2.1 | lib/daiku/plugins.rb |
daiku-0.2.0 | lib/daiku/plugins.rb |
daiku-0.1.1 | lib/daiku/plugins.rb |
daiku-0.1.0 | lib/daiku/plugins.rb |