Class: Sapphire::Plugins::PluginRepository
- Defined in:
- lib/sapphire/Plugins/PluginRepository.rb
Class Method Summary collapse
Instance Method Summary collapse
- #Add(observer) ⇒ Object
- #Find(method, object) ⇒ Object
-
#initialize ⇒ PluginRepository
constructor
A new instance of PluginRepository.
Constructor Details
#initialize ⇒ PluginRepository
Returns a new instance of PluginRepository.
14 15 16 17 |
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 14 def initialize @observers = [] @observer_types = [] end |
Class Method Details
.create ⇒ Object
6 7 8 |
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 6 def self.create @@instance ||= PluginRepository.new end |
.instance ⇒ Object
10 11 12 |
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 10 def self.instance @@instance ||= self.create end |
.observe ⇒ Object
31 32 33 |
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 31 def self.observe() end |
Instance Method Details
#Add(observer) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 20 def Add(observer) return if(@observer_types.include? observer.class) @observer_types << observer.class @observers << observer if !@observers.include? observer end |
#Find(method, object) ⇒ Object
27 28 29 |
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 27 def Find(method, object) @observers.select {|o| ((o.object == object or o.object == :all or object < o.object) and (o.method == method or o.method == :all)) } end |