Object
# File lib/bundler/index.rb, line 64 64: def <<(spec) 65: arr = @specs[spec.name] 66: 67: arr.delete_if do |s| 68: same_version?(s.version, spec.version) && s.platform == spec.platform 69: end 70: 71: arr << spec 72: spec 73: end
# File lib/bundler/index.rb, line 90 90: def ==(o) 91: all? do |s| 92: s2 = o[s].first and (s.dependencies & s2.dependencies).empty? 93: end 94: end
# File lib/bundler/index.rb, line 75 75: def each(&blk) 76: @specs.values.each do |specs| 77: specs.each(&blk) 78: end 79: end
# File lib/bundler/index.rb, line 29 29: def empty? 30: each { return false } 31: true 32: end
# File lib/bundler/index.rb, line 19 19: def initialize_copy(o) 20: super 21: @cache = {} 22: @specs = Hash.new { |h,k| h[k] = [] } 23: 24: o.specs.each do |name, array| 25: @specs[name] = array.dup 26: end 27: end
# File lib/bundler/index.rb, line 34 34: def search(query) 35: case query 36: when Gem::Specification, RemoteSpecification, LazySpecification then search_by_spec(query) 37: when String then @specs[query] 38: else search_by_dependency(query) 39: end 40: end
# File lib/bundler/index.rb, line 42 42: def search_for_all_platforms(dependency, base = []) 43: specs = @specs[dependency.name] + base 44: 45: wants_prerelease = dependency.requirement.prerelease? 46: only_prerelease = specs.all? {|spec| spec.version.prerelease? } 47: found = specs.select { |spec| dependency.matches_spec?(spec) } 48: 49: unless wants_prerelease || only_prerelease 50: found.reject! { |spec| spec.version.prerelease? } 51: end 52: 53: found.sort_by {|s| [s.version, s.platform.to_s == 'ruby' ? "\00"" : s.platform.to_s] } 54: end
# File lib/bundler/index.rb, line 104 104: def same_version?(a, b) 105: regex = /^(.*?)(?:\.0)*$/ 106: 107: ret = a.to_s[regex, 1] == b.to_s[regex, 1] 108: end
# File lib/bundler/index.rb, line 115 115: def search_by_dependency(dependency) 116: @cache[dependency.hash] ||= begin 117: specs = @specs[dependency.name] 118: 119: wants_prerelease = dependency.requirement.prerelease? 120: only_prerelease = specs.all? {|spec| spec.version.prerelease? } 121: found = specs.select { |spec| dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) } 122: 123: unless wants_prerelease || only_prerelease 124: found.reject! { |spec| spec.version.prerelease? } 125: end 126: 127: found.sort_by {|s| [s.version, s.platform.to_s == 'ruby' ? "\00"" : s.platform.to_s] } 128: end 129: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.