# File lib/gem_plugin.rb, line 101
101:     def load(needs = {})
102:       sdir = File.join(Gem.dir, "specifications")
103:       gems = Gem::SourceIndex.from_installed_gems(sdir)
104:       needs = needs.merge({"gem_plugin" => INCLUDE})
105: 
106:       gems.each do |path, gem|
107:         # don't load gems more than once
108:         next if @gems.has_key? gem.name        
109:         check = needs.dup
110: 
111:         # rolls through the depends and inverts anything it finds
112:         gem.dependencies.each do |dep|
113:           # this will fail if a gem is depended more than once
114:           if check.has_key? dep.name
115:             check[dep.name] = !check[dep.name]
116:           end
117:         end
118:         
119:         # now since excluded gems start as true, inverting them
120:         # makes them false so we'll skip this gem if any excludes are found
121:         if (check.select {|name,test| !test}).length == 0
122:           # looks like no needs were set to false, so it's good
123:           require "#{gem.name}/init"
124:           @gems[gem.name] = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
125:         end
126:       end
127: 
128:       return nil
129:     end