Class: Sapphire::Plugins::PluginRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/sapphire/Plugins/PluginRepository.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePluginRepository

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

.createObject



6
7
8
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 6

def self.create
  @@instance ||= PluginRepository.new
end

.instanceObject



10
11
12
# File 'lib/sapphire/Plugins/PluginRepository.rb', line 10

def self.instance
  @@instance ||= self.create
end

.observeObject



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