Sha256: c57190e8c452dd77b146f25c343a17b28d948d2034ef393e8081161522247cb6
Contents?: true
Size: 1.08 KB
Versions: 16
Compression:
Stored size: 1.08 KB
Contents
module Refinery class Plugins < Array def initialize @plugins = [] end def find_by_title(title) self.reject { |plugin| plugin.title != title }.first end def find_by_model(model) self.reject { |plugin| plugin.activity.reject {|activity| activity.class != model }.empty? }.first end def find_activity_by_model(model) plugin = find_by_model(model) plugin.activity.reject {|activity| activity.class != model}.first unless plugin.nil? end def [](title) self.find { |plugin| plugin.title == title } end def self.registered @registered_plugins ||= self.new end def titles self.collect { |p| p.title } end def in_menu self.reject{ |p| p.hide_from_menu } end def self.active @active_plugins ||= self.new end def self.always_allowed registered.reject { |p| !p.always_allow_access } end def self.set_active(titles) active.clear titles.each do |title| active << registered[title] if registered[title] end end end end
Version data entries
16 entries across 16 versions & 1 rubygems